Getting mouse position

Started by
14 comments, last by TomKQT 11 years, 11 months ago
I thought it worked, but it didn't. The window size is still the same :/
Advertisement
That's really weird.
When you do this, the rectangle doesn't change at all (or only 1 pixel as you said before)?

RECT rc = {0, 0, 200, 100};
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);


I tried it on Vista with Aero and the rectangle changed to:
top: -28
bottom: 108
left: -8
right: 208

Which means that the window has to be 216x136 pixels.
And the function also tells you how many pixels has to be added around the client area in individual directions, it's 8 pixels for borders and 28 pixels for the title bar (on my Vista, this depends on your OS and your settings, you can change the title bar size somewhere).
It changes to
Top: -1
Bottom: 101
Left: -1
Right: 201

But when I use the WS_OVERLAPPEDWINDOW (which is NOT the style my window uses), it creates a window that is so small, it has a height lower than 30 and a width lower than 100.
I've got really no idea, sorry. Maybe someone else could step in?

Btw, what style do you use for the window?
I'm using WS_OVERLAPPED | WS_SYSMENU | WS_BORDER.
I tried to change the window style to WS_OVERLAPPEDWINDOW and it worked fine with the AdjustWindowRect function.
But I want to make sure the window can't be maximized, can't be resized, and also I want to get rid of the minimize button at the top (not disable it).
How can I do this using other styles?

EDIT: Nevermind, I fixed it by changing the styles to WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU.
Everything is working now, thanks again!
So also the mouse coordinates are accurate now?
Glad I could help, good luck with the project.

This topic is closed to new replies.

Advertisement