Esempio n. 1
0
//////////////////
// Restore window placement from profile key
BOOL CWindowPlacement::Restore(LPCTSTR lpKeyName, CWnd* pWnd)
{
   GetProfileWP(lpKeyName);

   // Only restore if window intersets the screen.
   //
   CRect rcTemp, rcScreen(0,0,GetSystemMetrics(SM_CXSCREEN),
      GetSystemMetrics(SM_CYSCREEN));
   if (!::IntersectRect(&rcTemp, &rcNormalPosition, &rcScreen))
      return FALSE;

   pWnd->SetWindowPlacement(this);  // set placement
   return TRUE;
}
//----------------------------- FUNCTION -------------------------------------*
BOOL
    CWindowPlacement::Restore(LPCTSTR pszKeyName, CWnd* pWnd)
/*>>>> 
Restore window placement from profile key

Result
  TRUE if restore was ok
<<<<*/
{
    GetProfileWP(pszKeyName);

    // Only restore if window intersects the screen.
    //
    CRect rcTemp, rcScreen(0, 0, GetSystemMetrics(SM_CXSCREEN),
                                 GetSystemMetrics(SM_CYSCREEN));
    if (!::IntersectRect(&rcTemp, &rcNormalPosition, &rcScreen)) {
        return FALSE;
    }

    showCmd = SW_HIDE;
    pWnd->SetWindowPlacement(this);  // set placement
    return TRUE;
}