Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MessageSink : public CWnd
- {
- public:
- MessageSink() : windowClassName(::AfxRegisterWndClass(NULL))
- {
- }
- virtual ~MessageSink()
- {
- if(GetSafeHwnd())
- {
- ::DestroyWindow(GetSafeHwnd());
- }
- }
- BOOL Create()
- {
- return CreateEx(
- NULL,
- windowClassName,
- TEXT("Message Only Window"),
- 0,
- 0, 0, 0, 0,
- HWND_MESSAGE,
- NULL,
- /* user data */ NULL);
- }
- protected:
- DECLARE_MESSAGE_MAP()
- private:
- afx_msg LRESULT OnGoesNowhereDoesNothing(WPARAM, LPARAM)
- {
- ::AfxMessageBox(TEXT(__FUNCTION__));
- return 0;
- }
- afx_msg void OnDestroy()
- {
- ::AfxMessageBox(TEXT(__FUNCTION__));
- }
- CString windowClassName;
- };
- BEGIN_MESSAGE_MAP(MessageSink, CWnd)
- ON_MESSAGE(WM_USER + 1, OnGoesNowhereDoesNothing)
- ON_WM_DESTROY()
- END_MESSAGE_MAP()
Advertisement
Add Comment
Please, Sign In to add comment