Archived

This topic is now archived and is closed to further replies.

steg

Best way to create a message pump

Recommended Posts

steg    390
Hi, I have a thread and want it to accept windows messages, problem is, the thread has no user interface, hence no message pump. What is the best way to do one, does the following look ok ? while(true) { if (::GetMessage(&m, NULL, WM_BUTTON_RANGE_LOW , WM_BUTTON_RANGE_HI)) { ::TranslateMessage(&m); ::DispatchMessage(&m); } } BTW - this is in a MFC applicaiton DLL. Regards, Steve

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
see my answer to your other thread regarding the processing of non-window oriented msgs.

on NT/2K/XP, you can also create a message-only window if you want to have the msgs dispatched to a particular WindowProc but have no GUI. you do this by specifying HWND_MESSAGE as the parent to your window, either in the CreateWindow/Ex call or via SetParent.

on 9x, you can create a window without making it visible (don''t specify WS_VISIBLE and don''t call ShowWindow) and making it''s width and height = 0 to achieve the same result.

i have no idea how any of this applies to MFC though.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
try it. i''d imagine that the call would fail, but you never know.

Share this post


Link to post
Share on other sites