screen height/width

how do you get the screen width and height of the set moniter pixels (in windows) (microsoft vc++)

Hello,

This should be your answer:

int xpos = GetSystemMetrics( SM_CXSCREEN );
int ypos = GetSystemMetrics( SM_CYSCREEN );

  • VC6-OGL

Another way to do it is on the WM_SIZE message. I usually use this method because i need the size when i resize my viewport and reset my perspective projection.

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){

int width;
int height;

switch(msg){

case WM_SIZE:
width = (int)LOWORD(lParam);
height = (int)HIWORD(lParam);

  // call our resize procedure
  Resize(width, height);

  return 0;
  break;

}

the first one worked so plz dont reply, ill just use that from now on