Knowledge Base Nr: 00196 window_zentrieren.cpp - http://www.swe-kaiser.de

Downloads:

MFC: window zentriert aufblenden (immer im Vordergrund)

  
RECT rect;
GetWindowRect(&rect);
int dx = rect.right - rect.left;
int dy = rect.bottom - rect.top;

int x = (GetSystemMetrics(SM_CXFULLSCREEN) - dx) / 2;
int y = (GetSystemMetrics(SM_CYFULLSCREEN) - dy) / 2;
AfxGetMainWnd()->SetWindowPos(&wndTopMost, x, y, 0,0, SWP_NOSIZE|SWP_SHOWWINDOW);