共用方式為


CWindow::SendMessage

Sends a message to the window and does not return until the window procedure has processed the message.

LRESULT SendMessage(
   UINT message,
   WPARAM wParam = 0,
   LPARAM lParam = 0 
) throw();
static LRESULT SendMessage(
   HWND hWnd,
   UINT message,
   WPARAM wParam,
   LPARAM lParam 
) throw();

Remarks

See SendMessage in the Windows SDK.

Example

// The following example attaches a HWND to the CWindow
// object and sends a WM_PAINT message to the window
// wrapped by CWindow object using CWindow::SendMessage.

CWindow myWindow;
myWindow.Attach(hWnd);   
myWindow.SendMessage(WM_PAINT, 0L, 0L);

Requirements

Header: atlwin.h

See Also

Reference

CWindow Class

CWindow::PostMessage

CWindow::SendNotifyMessage

CWindow::SendMessageToDescendants

Other Resources

CWindow Members