Re: Find DesktopRegion in MFC VC++



On Sat, 30 Apr 2005 08:07:25 GMT, burt@xxxxxxxxxxxxxxxxx (Burt
Johnson) wrote:

>Not sure if this is the right group to ask this. If not, please direct
>me to where this stuff is discussed.
>
>I am working on a commercial application, and recently discovered a bug
>I have been asked to fix (they threw it back in my lap).
>
>Run the application on a 2-monitor system, such as a laptop in a dock
>with an external monitor. Drag the main window to the second
>(non-taskbar) window and quit. Now move the laptop to a different dock
>with the second menu on the other side (or without a second monitor at
>all) and launch the app.
>
>Oops. The app continues to want to go on the side it was last put, even
>though there is now no monitor there. (Yes, my dock in the office and at
>home have the second monitor on the opposite side, which is how I found
>the problem.)
>
>On the Macintosh, there is a concept of a "desktop grey region" that can
>be gotten, and an intersection of any particular window done. If the
>two do not intersect, the program knows to move ot the main window. I
>am pretty sure the same concept exists in MFC, as I see Excel and
>Outlook doing this switch when I move from office to home.
>
>How do I go about getting that region in MFC, and how do I ask the
>intersection with my window that I just opened?
>
>As you can probably tell, I'm pretty new to MFC. Just completed my 4th
>week using it... :-)

This is a very common problem with applications; since rearranging my
two monitors, I still have to occasionally use Alt+Space, M and move a
window into the visible area.

My applications retrieve the desktop region and create a region from
the application window rectangle. If the intersection of these is not
the app window, then some part of the application is not visible, in
which case I place it at the default position.

Unfortunately, I'm not very familiar with MFC, but you should be able
to use the CRgn (CRegion?) functions to do what you want.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.
.



Relevant Pages

  • Re: Title bar of Windows form is stuck in resize state when x coordina
    ... The bug is in these two lines, that will always result in positive ... It passes the hwnd of the external owner window as m_iHwnd. ... the problem wiht the title bar does not happen. ... In the monitor settings dialog, drag monitor 2 so that it is to the ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Title bar of Windows form is stuck in resize state when x coordina
    ... It passes the hwnd of the external owner window as m_iHwnd. ... The real host application is multithreaded so that the calling thread ... the problem wiht the title bar does not happen. ... In the monitor settings dialog, drag monitor 2 so that it is to the ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: SOME ASSISTANCE NEEDED
    ... > I will check into the video capture soon. ... everything necessary to do captures by seeing the images on the TV Monitor, ... not having the image show in the MovieCapture window is no big deal. ... This morning I found that one HAS to use the "Matrox Video Tools" if one is ...
    (rec.video.production)
  • Re: Mouse cursor disappears with Windows Media Center
    ... MCE window in max size, but went black again when I click the mouse button. ... I want to display MCE window on my primary monitor. ... Media Centre window. ... When I click on Media Centre Bar the cursor disappears from both screens. ...
    (microsoft.public.windows.mediacenter)
  • Re: Mouse cursor disappears with Windows Media Center
    ... I have dual screen and the mouse cursor disappears when I try to access the Media Centre window. ... The solution I seek is to be able to re-display Media Centre window on my monitor screen, not the TV screen, using the options and controls from the monitor screen, as I’ll explain in more detail. ... When I click on Media Centre Bar the cursor disappears from both screens. ...
    (microsoft.public.windows.mediacenter)

Loading