Threads and win32 message processing.
I have a feeling this is an abhorred question, but, I want to spawn a separate thread to process a given HWND's messages.
However, much to my dismay I discover that apparently one message can't be received by anything other than the process the HWND is created in (or something to that effect).
So essentially I would like to do this:
wnd = CreateWindow (...)
// ThreadProc is basically a function which implements the
// general win32 msg loop.
thread = CreateThread (NULL, 0, ThreadProc, wnd, 0, &threadID);
After searching this board I found a thread called:
"Reading win32 message loop from another thread" originall started by Starfall back in Feb/2000.
SetWindowsHookEx was mentioned, so I tried it out, hoping to hook onto sent msgs and use PostThreadMessage() to transfer these msgs into the msg loop thread's msg queue. A few system crashes later I notice that the HookProc must be in a .dll.
Is there a (possibly easier) way to do this without having to create a separate .dll for my hook proc?
EDIT: Just a quick note, that I've tried AttachThreadInput() but it never returns successfully.
--------------------------
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
Edited by - Promiscuous Robot on 11/20/00 7:49:04 PM
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Just a thought, but why not spawn a thread to do the rest of the processing instead.
Keys to success: Ability, ambition and opportunity.
Funny you should ask...
I''ve since thought about that, but I''ve been reluctant to do it because it just ''seems'' better the way I want to do it.
Maybe thats just because I really want to beat windows into submission....
I''ll probably end up doing just that. (Solving your way that is)
--------------------------
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''''s" - Unknown
I''ve since thought about that, but I''ve been reluctant to do it because it just ''seems'' better the way I want to do it.
Maybe thats just because I really want to beat windows into submission....
I''ll probably end up doing just that. (Solving your way that is)
--------------------------
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement