Discussion:
GetWindowInfo API function
(too old to reply)
Bob Hairgrove
2004-10-26 20:47:02 UTC
Permalink
There is a Windows API function called GetWindowInfo() which returns a
lot of useful information in a WINDOWINFO struct about any certain
window. Some of this information can also be retrieved individually,
but there is extremely little information about this struct and the
corresponding function in the latest documentation of the Platform
SDK.

Is there any advantage or disadvantage as to performance, for example
if I call GetClientRect() or GetWindowInfo(), since the client
rectangle is returned there as well? What about other parts such as
dwStyle and dwExStyle instead of calling GetWindowLong, etc.?

Thanks.

--
Bob Hairgrove
***@Home.com
Dennis Edward
2004-10-27 16:41:14 UTC
Permalink
Post by Bob Hairgrove
There is a Windows API function called GetWindowInfo() which returns a
lot of useful information in a WINDOWINFO struct about any certain
window. Some of this information can also be retrieved individually,
but there is extremely little information about this struct and the
corresponding function in the latest documentation of the Platform
SDK.
Is there any advantage or disadvantage as to performance, for example
if I call GetClientRect() or GetWindowInfo(), since the client
rectangle is returned there as well? What about other parts such as
dwStyle and dwExStyle instead of calling GetWindowLong, etc.?
I went to look up the function and couldn't find it (using VC6). What does
your help file say about which windows versions it's available under? If it
only works in, say, XP and 2K or newer, you might be unnecessarily limiting
yourself.
Bob Hairgrove
2004-10-27 20:21:53 UTC
Permalink
On Wed, 27 Oct 2004 16:41:14 GMT, "Dennis Edward"
Post by Dennis Edward
Post by Bob Hairgrove
There is a Windows API function called GetWindowInfo() which returns a
lot of useful information in a WINDOWINFO struct about any certain
window. Some of this information can also be retrieved individually,
but there is extremely little information about this struct and the
corresponding function in the latest documentation of the Platform
SDK.
Is there any advantage or disadvantage as to performance, for example
if I call GetClientRect() or GetWindowInfo(), since the client
rectangle is returned there as well? What about other parts such as
dwStyle and dwExStyle instead of calling GetWindowLong, etc.?
I went to look up the function and couldn't find it (using VC6). What does
your help file say about which windows versions it's available under? If it
only works in, say, XP and 2K or newer, you might be unnecessarily limiting
yourself.
Minimum OS requirements: Windows 98, Windows NT 4.0 SP6

(although it is also listed under new functions added for Windows NT
4.0 SP3 somewhere else).

Info: Platform SDK Release, February 2003

--
Bob Hairgrove
***@Home.com
Martijn
2004-10-27 21:13:18 UTC
Permalink
Post by Bob Hairgrove
There is a Windows API function called GetWindowInfo() which returns a
lot of useful information in a WINDOWINFO struct about any certain
window. Some of this information can also be retrieved individually,
but there is extremely little information about this struct and the
corresponding function in the latest documentation of the Platform
SDK.
My documentation doesn't even know about it at all, but MSDN does. I don't
know if it'll provide more info.
Post by Bob Hairgrove
Is there any advantage or disadvantage as to performance, for example
if I call GetClientRect() or GetWindowInfo(), since the client
rectangle is returned there as well? What about other parts such as
dwStyle and dwExStyle instead of calling GetWindowLong, etc.?
If you use many of the fields from the WINDOWINFO structure, it might be
more efficient. But on the other hand, the function GetWindowInfo might
just be implemented by invoking all the other functions you mentioned. Or
it might not. It makes a world of difference, so that is what I would
figure out first.

But then again, if it is not in a time critical section of your code,
nobody's going to notice those extra few nano- or microseconds and the
memory overhead is probably not terrifying either, so in that case I would
go with the more convenient option (which of course depends on the
problem/algorithm at hand).

Good luck,

--
Martijn
http://www.sereneconcepts.nl

Loading...