Jump to content
  • Advertisement
Sign in to follow this  
Reegan

GetWindowInfo(...) has gone up insane!

This topic is 3508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well heres the thing im using the WINDOWINFO structure for the same reason it exists.. but theres a problem with mine, and i cant figure it out, ive done what the documentation has said. and heres a screen shot of the values at runtime: http://img150.imageshack.us/my.php?image=failfb4.png As you can see, the values are completely out of whack for the window. any help? In particular, notice the values for rcClient struct. the size of my window is 800x600

Share this post


Link to post
Share on other sites
Advertisement
Is m_hWnd definitely valid and referring to the window you think it is? And what does GetWindowInfo return? If it's zero, then the WINDOWINFO struct won't be filled in (Which is what it looks like is happening).

Share this post


Link to post
Share on other sites
To answer your questions:

1) yes the m_hWnd is valid as it is passed to other functions that depend on it, and work without a problem.

2) I havent checked the return value, but i did use the function RtlZeroMemory() (further above in that code you can see, although you may not be able to see the actual line from that screen shot. so shouldnt the values all be NULL if the function failed?

Share this post


Link to post
Share on other sites
Quote:
Original post by Reegan
To answer your questions:

1) yes the m_hWnd is valid as it is passed to other functions that depend on it, and work without a problem.

2) I havent checked the return value, but i did use the function RtlZeroMemory() (further above in that code you can see, although you may not be able to see the actual line from that screen shot. so shouldnt the values all be NULL if the function failed?
Ah, I see. Yes, the function will just not touch the values rather than fill them with gibberish.
Are you sure the HWND is for the window you think it is (I.e. try using SetWindowText to set the caption)? That's just about the only thing I can think of. Failing that, try doing a clean build and see if the problem is still there.

Share this post


Link to post
Share on other sites
Yes the lpWnd->m_hWnd is working fine, i tested it with setting the window caption like you had asked. Also done a clean and rebuild but no changes

Share this post


Link to post
Share on other sites
I can't see the window on your task bar - are you sure it's being created properly? Also, you could try calling ShowWindow() & UpdateWindow() before getting the window info.

Otherwise, check the return value and call GetLastError() if necessary.

Share this post


Link to post
Share on other sites
@Beeps: yes the window is being created properly if something else was wrong i would be asking questions about that or trying t fix it on my own, but no, everything is fine except the WINDOWINFO struct.

@Endurion: Ok then, so im using the WINDOWINFO struct wrong, or microsoft have made a mistake?


Thanks for your time
~Reegan

Share this post


Link to post
Share on other sites
Quote:
Original post by Reegan
@Endurion: Ok then, so im using the WINDOWINFO struct wrong, or microsoft have made a mistake?
You're using it wrong - the rcClient is the rectangle for the client area, not just it's size. So the client area size is (rcClient.right - rcClient.left, rcClient.bottom - rcClient.top). And you can see that rcClient.right-rcClient.left + cxWindowBorders*2 == 800.

Share this post


Link to post
Share on other sites
Im afraid to tell you, that im not using it wrong, before i used WindowGetInfo(...) i used to use GetClientRect(...) which works just fine for the client rect.

There is something wrong with WindowGetInfo(...)

sorry that you guys couldnt figure it out =/

EDIT:
Quote:
rcClient.right-rcClient.left + cxWindowBorders*2 == 800.

rcClient.left is always 0 same goes for rcClient.top (or rather, it should always be 0)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!