Create thread message queue without creating window? 
Author Message
 Create thread message queue without creating window?

Is there a way to create a message queue for a thread, without having to
create a window just to get the message queue?  I want to post messages
to a thread I have, but I have absolutely no need for a window on that
thread.

Thanks.



Sat, 22 Mar 2003 13:40:18 GMT  
 Create thread message queue without creating window?

Hi!

If your thread is based on a class - you can provide a method where clients
can deliver information thread will use. If you're not using classes you
should make a global function available to the clients to call.

The method/function will do the adding of an element to some list available
to your thread. You should of-course make the method/function thread safe
with synchronizer objects. The easiest would be using a CRITICAL_SECTION.

Terje Viken
Floroe, Norway



Quote:
> Is there a way to create a message queue for a thread, without having to
> create a window just to get the message queue?  I want to post messages
> to a thread I have, but I have absolutely no need for a window on that
> thread.

> Thanks.



Sat, 22 Mar 2003 03:00:00 GMT  
 Create thread message queue without creating window?

The message queue is created for a thread the first time it calls any
finction in USER32. This means you can just run a message pump in a thread,
not creating any windows, and other threads can use PostThreadMessage to
queue messages to the thread. Also, SetTimer with Callback proc works with
no windows (the message pump is still necessary, of course).
--
With best wishes,
    Igor Tandetnik


Quote:
> Is there a way to create a message queue for a thread, without having to
> create a window just to get the message queue?  I want to post messages
> to a thread I have, but I have absolutely no need for a window on that
> thread.

> Thanks.



Sat, 22 Mar 2003 03:00:00 GMT  
 Create thread message queue without creating window?


Quote:
> Is there a way to create a message queue for a thread, without having to
> create a window just to get the message queue?  I want to post messages
> to a thread I have, but I have absolutely no need for a window on that
> thread.

I'm not sure of the{*filter*}details, but a thread's queue is created the moment
that Windows decides one is needed. There is no necessity to have a window.
Just be sure that the thread that posts the messages checks the status code
returned by PostMessage(). If the receiver's queue has not been created the
post operation will fail.

Regards,
Will



Sat, 22 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Can i create my own message queue ??

2. Creating my own message queue

3. Creating windows without window dressings

4. Creating a UI thread without using RUNTIME_CLASS

5. How to create a windows without border?

6. Creating Window without MFC

7. How to create a windows without border?

8. Creating a window using FormView - without using CMultiDocTemplate

9. Creating A Window Without A Caption Bar.....

10. How to create a windows without border?

11. Creating MDI child windows without focus

12. OnFileNew() without creating a child window

 

 
Powered by phpBB® Forum Software