共用方式為


CWindow::PostMessage

Places a message in the message queue associated with the thread that created the window.

BOOL PostMessage(
   UINT message,
   WPARAM wParam = 0,
   LPARAM lParam = 0 
) throw();

Remarks

See PostMessage in the Windows SDK.

Returns without waiting for the thread to process the message.

Example

//The following example attaches an HWND to the CWindow object and 
//posts a WM_PAINT message to the Window wrapped by the CWindow object 
//using CWindow::PostMessage() with the default values of WPARAM and 
//LPARAM

CWindow myWindow;
myWindow.Attach(hWnd);
myWindow.PostMessage(WM_PAINT);

Requirements

Header: atlwin.h

See Also

Reference

CWindow Class

CWindow::SendMessage

CWindow::SendNotifyMessage

Other Resources

CWindow Members