Archive: IsWindow/FindWindow problem?


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?


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


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.


OK, as I said in the first post, I'm just dumb, it's the third param.
/me beats himself :/


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.