-
January 7th, 2011, 01:00 AM
#1
Desktop Coordinates
How can I store Desktop coordinates into a CRect?
-
January 7th, 2011, 02:17 AM
#2
Re: Desktop Coordinates
Don't you know what CRect is or is your problem to obtain coordinates?
If the former - look at the DSDN article describing CRect.
If the latter - define "desktop": if it is the window which handle GetDesktopWindow returns then use this handle to GetWindowRect.
If it is something else - have a look at GetSystemMetrics, SystemParametersInfo, EnumDisplayMonitors and so on...
Victor Nijegorodov
-
January 7th, 2011, 04:20 AM
#3
Re: Desktop Coordinates
Originally Posted by VictorN
Don't you know what CRect is or is your problem to obtain coordinates?
If the former - look at the DSDN article describing CRect.
If the latter - define "desktop": if it is the window which handle GetDesktopWindow returns then use this handle to GetWindowRect.
If it is something else - have a look at GetSystemMetrics, SystemParametersInfo, EnumDisplayMonitors and so on...
OK thanks, I managed to get the Desktop area.
Code:
CRect wndRect;
ShowWindow(SW_SHOW);
SystemParametersInfo(SPI_GETWORKAREA, NULL,&wndRect, NULL);
SetWindowPos(&wndTopMost, wndRect.right, wndRect.bottom, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
in wndRect it is storing the right resolution. Now in SetWindowPos I have specified bottom right coordinate for the window to be placed so that i looks like MSN Messenger Alart. But somehow, the window is not getting placed over there, instead its still there in center
-
January 7th, 2011, 04:27 AM
#4
Re: Desktop Coordinates
Originally Posted by maverick786us
Code:
CRect wndRect;
ShowWindow(SW_SHOW);
SystemParametersInfo(SPI_GETWORKAREA, NULL,&wndRect, NULL);
SetWindowPos(&wndTopMost, wndRect.right, wndRect.bottom, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
... But somehow, the window is not getting placed over there, instead its still there in center
I wonder why are you passing any coordinates and width/height in the case of using SWP_NOMOVE | SWP_NOSIZE flags?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|