Is it possible to find the hwnd from ClassName, not from the Window Text?
Cecil
Find HWND from Class
-
cecilcheah
- Enthusiast

- Posts: 168
- Joined: Wed Jun 04, 2003 8:44 am
- Location: Switzerland
Re: Find HWND from Class
This should be possible with FindWindowEx_().
If the last parameter "lpszWindow" is #NULL, all window names will
match thus only the 3rd parameter "lpszClass" will be used.
Is that what you're after?
If the last parameter "lpszWindow" is #NULL, all window names will
match thus only the 3rd parameter "lpszClass" will be used.
Is that what you're after?
Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: Find HWND from Class
> Is it possible to find the hwnd from ClassName, not from the Window Text?
The FindWindow API has two parameters: title and class. Take your pick.
The FindWindow API has two parameters: title and class. Take your pick.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Find HWND from Class
Yes, like this:cecilcheah wrote:Is it possible to find the hwnd from ClassName, not from the Window Text?
Cecil
Code: Select all
Handle = FindWindow_("XClass", 0)
ARGENTINA WORLD CHAMPION
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Just don't forget that there can be multiple windows of the same class up at any given time, so if you are going by class only you will need to iterate through all the windows it finds to get the one you want. Unless you are looking for a window with a classname you have registered and you know to be unique, of course.
BERESHEIT
