Desktop Coordinates
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Desktop Coordinates

  1. #1
    Join Date
    Apr 2005
    Posts
    1,760

    Desktop Coordinates

    How can I store Desktop coordinates into a CRect?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,421

    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

  3. #3
    Join Date
    Apr 2005
    Posts
    1,760

    Re: Desktop Coordinates

    Quote Originally Posted by VictorN View Post
    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

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,421

    Re: Desktop Coordinates

    Quote Originally Posted by maverick786us View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center