[C\C++] - putting the window in center of screen

  • Thread starter Thread starter Cambalinho
  • Start date Start date
C

Cambalinho

Guest
if (Center==TRUE)
{
HWND hwndScreen;
RECT rectScreen;
int ConsolePosX;
int ConsolePosY;

hwndScreen=GetDesktopWindow ();
GetWindowRect(hwndScreen,&rectScreen);
ConsolePosX = ((rectScreen.right-rectScreen.left)/2 -Width/2 );
ConsolePosY = ((rectScreen.bottom-rectScreen.top)/2- Height/2 );

SetWindowPos(hwnwindow,HWND_NOTOPMOST,ConsolePosX,ConsolePosY,0,0,SWP_NOOWNERZORDER);
}

the GetDesktopWindow() give us the screen HWND???

i need put the window in center of screen, but these code ins't correct:(

Continue reading...
 
Back
Top