LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
SendMessage發(fā)送消息并等待消息得理結(jié)果,再返回本消息被某線程處理后的值
BOOL PostMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
PostMessage是將消息放入消息隊(duì)列后立即返回 而不管這個(gè)消息被處理
BOOL GetMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
GetMessage從消息隊(duì)列取一個(gè)消息,。放入lpMsg中,,如果消息隊(duì)列為空,,則一直等待,。直到有消息為止.
BOOL PeekMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);
PeekMessage查看下消息隊(duì)列,如有消息則將消息從消息隊(duì)列中“放入”或"拷貝"到lpMsg中,,
如果沒有消息則函數(shù)立即返回.
wRemoveMsg標(biāo)志指示,,是否從隊(duì)列中刪除掉這條被拿出的消息。
如果wRemoveMsg是 PM_REMOVE 則peekmessage將消息"放入"lpMsg 這時(shí)消息隊(duì)列中沒有了此消息
如果wRemoveMsg是PM_NOREMOVE 則peekmessage將消息"拷貝"一份放入lpMsg 消息仍在消息隊(duì)列中
所謂"處理消息"指后面跟上
TranslateMessage(&msg);
DispatchMessage(&msg);
將消息轉(zhuǎn)發(fā)給wndproc();
或是你自已switch(msg)后進(jìn)行case操作.
GetMessage你可以認(rèn)為它是將消息從消息隊(duì)列中刪除了的,。(特殊消息WM_PAINT除外)
所以GetMessage后面你要么處理消息,,要么轉(zhuǎn)發(fā)消息.否則消息就會(huì)丟失。