當主窗口的客戶區部分大小改變時,我們的應用程序將接收到
WM_SIZE
消息。當然該窗口第一次顯示時,我們也將接收到該消息。要接收到該消息,主窗口必須有
CS_VREDRAW
和
CS_HREDRAW
風格。我們應該把縮放編輯控件的動作放到此處。我們要把編輯控件變成和我們的窗口客戶區一樣大,所以先得要得到父窗口客戶區的大小。這些值包含在參數
lParam
中,
lParam
的高字部分是客戶區的高,底字部分是客戶區的寬。然后我們調用
MoveWindow
函數來重新調整編輯控件的大小,該函數不僅能夠移動窗口的位置,而且能夠改變窗口的大小。
.ELSEIF uMsg==WM_SIZE
??mov eax,lParam????????????? ;低16位寬,高16位高
??mov edx,eax
??shr edx,16????????????????? ;IParam邏輯右移16位,保留高16位,即高
??and eax,0ffffh????????????? ;高16位清0,保留低16位,即寬
??invoke MoveWindow,hwndEdit,0,0,eax,edx,TRUE
WM_SIZE
The WM_SIZE message is sent to a window after its size has changed.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_SIZE WPARAMwParam, // resizing flag LPARAMlParam // client area );
Parameters
- wParam
- Specifies the type of resizing requested. This parameter can be one of the following values.
Value Meaning SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized. SIZE_MAXIMIZED The window has been maximized. SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size. SIZE_MINIMIZED The window has been minimized. SIZE_RESTORED The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies. - lParam
- The low-order word of lParam specifies the new width of the client area.
The high-order word of lParam specifies the new height of the client area.
Return Values
If an application processes this message, it should return zero.
該版本的編譯器發布時間是2007年10月6日星期六18:19:41.
推薦給 C語言 愛好者 本例是用LCC_Win32(版本為4.0)的一個真正的windows程序
能夠播放聲音文件,要包含頭文件<mmsystem.h>,在工程中加入多媒體庫文件winmm.lib
http://www.abab123.com/bbs/down.asp?html=1001248