PDA

View Full Version : screen height/width



joeshrewn
01-24-2003, 08:12 AM
how do you get the screen width and height of the set moniter pixels (in windows) (microsoft vc++)

Stack Overflow
01-24-2003, 08:29 AM
Hello,

This should be your answer:

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

- VC6-OGL

Halcyon
01-25-2003, 08:43 AM
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;
}

joeshrewn
01-25-2003, 12:54 PM
the first one worked so plz dont reply, ill just use that from now on