How to check if window is hidden or shown
Hi,
I want to ask, how I can check if a window (Field of Install Options) is hidden or shown?
Thanks in advance
Archive: How to check if window is hidden or shown
How to check if window is hidden or shown
Hi,
I want to ask, how I can check if a window (Field of Install Options) is hidden or shown?
Thanks in advance
Impossible?
I've read your post twice, still I'm not able to figure what exactly you're referring...
Guessing that saying window you mean the instruction EnableWindow and Field of Install Options means a control on a custom page, and probably hidden or shown means enabled or disabled...
Well, this is script depended, you specify in your script under which condition the control needs to be enabled/disabled.
Chieftec,
If you wish to check if a control is VISIBLE (e.g. if toggled with ShowWindow), you need to test the window's style for the WS_VISIBLE flag.
If you wish to check if a keyboard/mouse input for a control is enabled (e.g. is toggled with EnableWindow), you can test the control for the WS_DISABLED flag.
You can do the checks using the System plugin and calling the GetWindowStyle API, you can use search to find several examples here in the forums.
Originally posted by BacklandThats exactly what I want to do ;)
If you wish to check if a control is VISIBLE (e.g. if toggled with ShowWindow), you need to test the window's style for the WS_VISIBLE flag.
Originally posted by BacklandI searched the forum, but didn't found examples to GetWindowStyle or WS_VISIBLE.
You can do the checks using the System plugin and calling the GetWindowStyle API, you can use search to find several examples here in the forums.
Here is an example for getting the style flags of control (by Kichik)
!define GWL_STYLE -16I havent got access to NSIS right now to create an example, but you should be able to check for the WS_VISIBLE flag using IntCmp.
>!define BS_DEFPUSHBUTTON 1
GetDlgItem$0 $HWNDPARENT 1
System::Call "user32::GetWindowLongA(i $0, i ${GWL_STYLE}) i .s"
>Pop $1
>
I tried to check the window visibility with the code you posted but it doesn't work.
I also read and compiled the examples in NSIS\Examples\System ...define WS_VISIBLE 0x10000000
::initDialog /NOUNLOAD "$PLUGINSDIR\ioA.ini"
InstallOptions
Pop $0
GetDlgItem$1 $0 1200
System::Call "user32::GetWindowLongA(i $0, i ${WS_VISIBLE}) i .s"
Pop $1
>
- push :(
There's IsWindowVisible, so there's no need for GetWindowLong.
StrCpy $0 "some hwnd"
System::Call "user32::IsWindowVisible(i r0)"i.r0
# $0 here is non-zero if the window is visible.
Thank you for your reply ;)
Is this the correct code?
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\ioA.ini"
Pop $1
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ioA.ini" "Field 1" "HWND"
System::Call "user32::IsWindowVisible(i r0)"i.r0
# $0 here is non-zero if the window is visible.
MessageBox mb_ok "$0"
The code I posted above, won't work...
Can someone say me what's wrong?
Regards
That's because `i.r0` should be in the quotes. Little typo of mine...
System::Call "user32::IsWindowVisible(i r0)i.r0"
But even with this change, you'll always get 0 because the custom dialog doesn't show until installOptions::show is called.Thank, that works ;)
Originally posted by kichikinstallOptions::show is already called when I use the function (yes, in the code I posted above it isn't)
But even with this change, you'll always get 0 because the custom dialog doesn't show until installOptions::show is called.