Netsabes
7th October 2002 16:49 UTC
IsWindow/FindWindow problem?
I'm using the cvs version of NSIS.
Maybe I'm just dumb, but I'm unable to find any window with the following code:
-----
Name "IsWindowTest"
OutFile "IsWindow.exe"
autoCloseWindow true
Section
IsWindow "${NAME}" ok notok
ok:
MessageBox MB_OK "${NAME} is a window"
notok:
MessageBox MB_OK "${NAME} is not a window"
SectionEnd
;eof
-----
(use makensis with /DNAME, or add a !define NAME in the code)
I've tried with a lot opened programs (tried with /DNAME= "KMeleon", "Winamp", "Winamp v1.x", "Winamp v2.x", "Winamp v2.81", "TextPad", "Mozilla", "Phoenix" and some more) and it kept displaying that they were not windows.
Same with FindWindow.
Am I really dumb (and what should i do then? :), or it is broken?
dselkirk
7th October 2002 19:35 UTC
try this:
Name "IsWindowTest"
OutFile "IsWindow.exe"
autoCloseWindow true
!define NAME "IsWindowTest Setup: Installing Files"
Section
FindWindow $R1 "" "${NAME}"
IsWindow $R1 0 lblNotWindow
MessageBox MB_OK "${NAME} is a window"
Goto lblContinue
lblNotWindow:
MessageBox MB_OK "${NAME} is not a window"
lblContinue:
SectionEnd
Netsabes
7th October 2002 20:00 UTC
Thx, your code is working. But what would be the name of the program (the first arg of FindWindow)? ie. if I want to find a program and not only a window of it, where is this name defined?
I modified your example with
FindWindow $R1 "${NAME}" instead of FindWindow $R1 "" "${NAME}" to find the program itself, and then tried with "IsWindowTest", "IsWindowTest Setup" as well as "IsWindowTest Setup: Installing Files", and the window was not found.
Netsabes
8th October 2002 12:57 UTC
OK, as I said in the first post, I'm just dumb, it's the third param.
/me beats himself :/
dselkirk
8th October 2002 14:25 UTC
no worries. Just remember when using findwindow that the third parameter is the window title. Also make sure that the title your searching for does exist. good luck.