How do i get some info from the window ??
I''m using win32 api to create my window. i need the width . can wparam or lparam send me this message?? or am i totaly wrong in what i''m doing?? i need the width and height of the window and be able to resize it.
thx alot
From the MSDN :
The WM_SIZE message is sent to a window after its size has changed.
WM_SIZE
fwSizeType = wParam; // resizing flag
nWidth = LOWORD(lParam); // width of client area
nHeight = HIWORD(lParam); // height of client area
RTFM at http://msdn.microsoft.com
The WM_SIZE message is sent to a window after its size has changed.
WM_SIZE
fwSizeType = wParam; // resizing flag
nWidth = LOWORD(lParam); // width of client area
nHeight = HIWORD(lParam); // height of client area
RTFM at http://msdn.microsoft.com
It is sent when the window is created too... that makes many things simpler
Joakim Asplund
http://megajocke.cjb.net
Joakim Asplund
http://megajocke.cjb.net
quote:Original post by Prosper/LOADED
From the MSDN :
The WM_SIZE message is sent to a window after its size has changed.
WM_SIZE
fwSizeType = wParam; // resizing flag
nWidth = LOWORD(lParam); // width of client area
nHeight = HIWORD(lParam); // height of client area
RTFM at http://msdn.microsoft.com
my prob is thata i have a window using opengl that is 300x300 when i resize it it need to set glViewPort and gluPerspective to the size of the window. So would this solve my prob ?
//in the window proccase WM_SIZE: glViewPort(0,0,/*width*/LOWORD(lParam),/*height*/HIWORD(lparam)); gluPerspective(0.45f,(GLfloat) LOWORD(lParam) / (GLfloat) HIWORD(lParam),0.1f,100.0f);break;
[edited by - Metal Typhoon on June 7, 2002 1:46:17 PM]
If you really wanna. I do it like this:
Then, call SizeOGL() when you receive the WM_SIZE message.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
ErrorCode CEngine::SizeOpenGL(){ RECT WindowRect; GetClientRect(WindowHandle, &WindowRect); glViewport(0, 0, WindowRect.right, WindowRect.bottom); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //insert perspective calculations (gluPerspective, etc.) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return CAFFEINE_OK;}
Then, call SizeOGL() when you receive the WM_SIZE message.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
quote:Original post by ZealousElixir
If you really wanna. I do it like this:ErrorCode CEngine::SizeOpenGL(){ RECT WindowRect; GetClientRect(WindowHandle, &WindowRect); glViewport(0, 0, WindowRect.right, WindowRect.bottom); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //insert perspective calculations (gluPerspective, etc.) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return CAFFEINE_OK;}
Then, call SizeOGL() when you receive the WM_SIZE message.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
i didn''t know how to use RECT so NOw i now
GetClientRect(hWnd,&WindowRect) will return me the top,left,widtrh and height of the window right ?
It returns the size of the client araea, in client area coordinates, so left and top is usually 0, right is width and bottom is height.
Joakim Asplund
http://megajocke.cjb.net
Joakim Asplund
http://megajocke.cjb.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement