View Full Version : FindWindow *boggle*
20th March 2001, 03:42
Alright, so I admit: I'm an amateur programmer. Right now I'm using Visual Basic 6. I'm wondering if anyone has used VB and FindWindow to detect whether their application is running or not.
Maybe I'm missing something here. Could someone explain how FindWindow works and what exactly a WindowClass is? I feel really stupid asking these questions but I gotta learn somehow :-D.
20th March 2001, 07:04
Doesn't VB use the CreateWindowEx function of the WIN32 API? Three you have to specify one parameter: the ClassName. It is like the template of a Window.
You can e.g. you the free util atm (Another Task Manager) http://atm.idic.caos.it/higheng.html (it's like 80kb or so IIRC), to choose a process and get a list of its Windows and ClassNames, if you are not sure.
Winamp2 will e.g. use the ClassName "Winamp v1.x" for it's main Window. Other programms (like ICQ) have just a cryptic name AFX:40000 (or similar) for their class.
20th March 2001, 21:14
Unfortunately, it appears that VB automatically assigns windowclass names to an application. Is there anyway that FindWindow could also accept a Window Title? For example, if I wanted to find Internet Explorer with NSIS, I could just do:
FindWindow prompt "Microsoft Internet Explorer" "bleh bleh bleh"
If not, has anyone been able to use FindWindow with their VB application?
20th March 2001, 21:45
I know that the MFC FindWindow function in Visual C++ can do a find Window on a Window Title so I am sure that it can be put into the NSIS source code if you need it to do that.
20th March 2001, 23:42
All VB programs will have the same classname.
ThunderRT6Form >> For VB 6
ThunderRT5Form >> For VB 5
.. and so on.
Unless Justin updates NSIS to have an option to read the window title you're out of luck.
21st March 2001, 03:19
I decided that it would be useful to find windows based on title so I added to my own personal version, if you want it download it from http://www.shoutclub.com/nsis/
Justin feel free to modify it for your version the source code is included and is just below your FindWindow Function.
To use the function just put this in your script
FindWindowTitle <mode> <Window title> <Message Prompt>
Let me know how it works out, this is the first time I have modified this code and it appears to work fine on my system.
21st March 2001, 03:29
Thanks! Works great.
By the way, it appears that your change also affected the FindWindow command. I was able to use FindWindow and FindWindowTitle interchangeably.
21st March 2001, 03:37
hmmm I am not able to duplicate that here, if I do a search for a window title with FindWindow, it doesn't appear to work only FindWindowTitle can find a window by title.
FindWindow will only search for windows by class, at least that the only way I can do it here.
Does FindWindow work with class names still?
Can you give me an example of what you are trying to do?
21st March 2001, 03:41
I've tried it with my application, and other applications. FindWindow works with both Window Title and WindowClass name.
21st March 2001, 03:45
Sorry, what I'm doing is this:
FindWindow prompt "#32770" "bleh bleh bleh"
I get the message box with Retry, Abort, and Ignore
FindWindow prompt "11136292" "bleh"
If I do:
FindWindow prompt "sdfkjsdfkljsdfl" "bleh"
no message box
However, this does not work with FindWindowTitle. It will only accept Window Titles.
21st March 2001, 03:56
ok I found the bug
Bad switch statement on my part
it would probably be a good idea to download this new version. I am not sure what adverse effects the other version could have on other commands.
download from same location as above
21st March 2001, 04:00
Thanks again. I applied the previous tests to the new version and it seems to work great.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.