07.03.2013 Views

Multithreading Multi-Threaded Programming

Multithreading Multi-Threaded Programming

Multithreading Multi-Threaded Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

What kind Msg in the PostMessage do you<br />

post?<br />

} Any user-defined message will do.<br />

} Assume you defined a private window message called WM_COMPLETE:<br />

} Declare user message ID<br />

} Declare message handling function in the .h file<br />

} Map the message to the handling function in .cpp file<br />

} Implement the message handling functon in .cpp file<br />

21<br />

#define WM_COMPLETE (WM_USER + 100)<br />

…<br />

afx_msg LRESULT OnComplete(WPARAM wParam, LPARAM lParam);<br />

DECLARE_MESSAGE_MAP()<br />

BEGIN_MESSAGE_MAP(CMYDlg, CDialog)<br />

…<br />

ON_MESSAGE(WM_COMPLETE,OnComplete)<br />

END_MESSAGE_MAP()<br />

LRESULT CMyDlg::OnComplete(WPARAM wParam, LPARAM lParam)<br />

{ ... return 0; }<br />

Advanced Windows Network <strong>Programming</strong><br />

11/11/12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!