Archive: Hide a control?


Hide a control?
  is is possible to hide a control?


Nope, not yet.


not even with sendmessage?


No, you have to change the window's style with GetWindowLong and SetWindowLong, or just use the good old ShowWindow :)


i was thinking of the showwindow but was trying to find a way without writing a plugin


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.


I tried creating a plugin but it hide the control
Weren't you trying to hide the control? :weird:
ShowWindow should work fine if you give a valid window handle (HWND).

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


What's variables? Have you poped the variable out? Have you converted it to an integer value?


i used ExDLL as a base. variables translates to $R1.


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.


I just tried that, still nothing.


Use IsWindow in NSIS and in your DLL to check out if you get a real HWND.


It does return a real hwnd


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.


tried both, different controls, even the main window. the best I can do is get the main window to flash once.


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"


FindWindow $R1 "#32770" "" $HWNDPARENT

should be:

FindWindow $R1 "#32770" 0 $HWNDPARENT

If I remember correctly. Try it...


nope, the same.



FindWindow $R8 "#32770" "" $HWNDPARENT

GetDlgItem $R8 $R8 1006
SetStaticBkColor $R8 0x00BAFAFF
>
This works for me... Are you using it in .onInitDialog?

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


In .onNextPage the dialog hasn't been created yet... Use .onInitDialog.


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.


sorry, the plgin say its not a valid hwnd when the script says it is.


Thanks kichik, as you said, just needed to pop the string.


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::Disable hwnd

Example:
Hide the version label

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

Also see ShowWin.nsi.

---------------------------------------------------------
Copyright (c) 2002 Don Selkirk


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.


The built in ShowWindow instruction doesn't work?

-Stu


Hi Afrow,
I just want to hide a single control, not the entire window, I tried sending msg to window as well.


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.


Thanks kichik,

It worked for me.
NSIS rocks.


Hello guys,

First of all thanks for all your help, I was able to remove the titlebar of an application (Opera) with

System::Call 'user32::SetWindowLong(i $5,i -16,i 339871820)'

The problem is that after the titlebar is gone and I right-click on Opera on the tray, there's no pop-up menu with close, minimize, etc items.
Is this a drawback of that method or is there a way to fix it?

Another question: how can I restore the titlebar after I've removed? Or it's impossible?

Thanks in advance,

tpr