Skip to content
⌘ NSIS Forum Archive

Hide a control?

32 posts

kichik#
No, you have to change the window's style with GetWindowLong and SetWindowLong, or just use the good old ShowWindow 🙂
dselkirk#
I tried creating a plugin but it hide the control. do you think there would be any limitation to using the ShowWindow api to hide a control.
kichik#
I tried creating a plugin but it hide the control
Weren't you trying to hide the control? 🤪
ShowWindow should work fine if you give a valid window handle (HWND).
dselkirk#
yup, didn't work.

created a plugin called HideWin. in the function HideWin I call the following.

ShowWindow((HWND)variables,SW_HIDE);

In the script I call the following (for example)

GetDlgItem $R1 $HWNDPARENT 1028
HideWin $R1
kichik#
What's variables? Have you poped the variable out? Have you converted it to an integer value?
kichik#
You have to convert it to a number first. NSIS gives you a string, and HWND is actually a number. Use myatoi from NSIS source.
kichik#
Hmm... Get it's text, make sure it is the one you want. Make sure you are getting the control from the right window, you are currently getting it from the parent window, not the inner window.
dselkirk#
tried both, different controls, even the main window. the best I can do is get the main window to flash once.
dselkirk#
ohm and get this. the following code doesn't return a valid hwnd.

FindWindow $R1 "#32770" "" $HWNDPARENT
IsWindow $R1 +2 0
MessageBox MB_OK "not a window handle"
kichik#
FindWindow $R1 "#32770" "" $HWNDPARENT

should be:

FindWindow $R1 "#32770" 0 $HWNDPARENT

If I remember correctly. Try it...
kichik#
FindWindow $R8 "#32770" "" $HWNDPARENT
GetDlgItem $R8 $R8 1006
SetStaticBkColor $R8 0x00BAFAFF 
This works for me... Are you using it in .onInitDialog?
dselkirk#
just playin withit and for some reason the findwindow isn't returnning a hwnd.

FindWindow $R1 "#32770" "" $HWNDPARENT

returns 0

I'm doing it on the nextpage of a test installer, latest cvs

here's the test

Name "Test Install"
OutFile "test.exe"

DirText "Choose dir"

Section ""
SectionEnd

Function .onNextPage
FindWindow $R1 "#32770" "" $HWNDPARENT
MessageBox MB_OK $R1
FunctionEnd
dselkirk#
that just fixed the problem with the findwindow returning 0. I switched after you posted that message about the critial error. I switched it back to oninitdialog. still doesn't work. The plugin gets a valid hwnd too.
dselkirk#
ShowWin Plugin
---------------------------------------------------------

Description:
ShowWin is a small plugin which will allow you to hide,
show, enable and disable controls.

Usage:
ShowWin::Show hwnd
ShowWin::Hide hwnd
ShowWin::Enable hwnd
ShowWin:😁isable hwnd

Example:
Hide the version label

GetDlgItem $R1 $HWNDPARENT 1028
ShowWin::Hide $R1

Also see ShowWin.nsi.

---------------------------------------------------------
Copyright (c) 2002 Don Selkirk
n_baua#
Can you just compile a plugin and put the dll...?
I may need it badly.

If this feature is already included in newer versions please let me know I am not aware much of NSIS functionality.

Thanks in advance.
n_baua#
Hi Afrow,
I just want to hide a single control, not the entire window, I tried sending msg to window as well.
kichik#
ShowWindow does exactly what this plug-in does. Get the HWND of the control you want to hide using FindWindow and GetDlgItem and use ShowWindow on it, passing 0 or ${WM_HIDE} on the second parameter.