HWND_OBJECT

HWND_OBJECT

Post by Keith Braffo » Tue, 01 Mar 1994 23:13:36



What's the difference between spawning a thread that creates a HWND_OBJECT
window and one that creates a Message queue?  Why would one be used over
another?

Thanks,

 
 
 

HWND_OBJECT

Post by os2.. » Wed, 02 Mar 1994 07:15:17



Quote:>What's the difference between spawning a thread that creates a HWND_OBJECT
>window and one that creates a Message queue?  Why would one be used over
>another?

Message queues are unique to threads, so your question is invalid, since -
in order to create an object window (a window whose parent is HWND_OBJECT) -
you have to have a message queue for that thread.

Cheers,
Q
--
Have you read this month's EDM/2?  Send an empty email message to

receive back issues, etc.  Send all comments, complaints, suggestions


 
 
 

HWND_OBJECT

Post by Keith Braffo » Wed, 02 Mar 1994 12:07:02


: Message queues are unique to threads, so your question is invalid, since -
: in order to create an object window (a window whose parent is HWND_OBJECT) -
: you have to have a message queue for that thread.

I don't understand.  I realize that a message queue is unique to a thread,
but I was refering to two cases where you spawn off a separate thread
to do work.  Usually I have done this in my code's secondary thread:

thread(dummy) {
   get hab
   get msg q

   while (WinGetMsg(msg)) {
      switch message:
         case for each job

Quote:}}

However, I saw in EDM/2 issue 8 that Semir Patel uses an object window to
accomplish (what I *perceive* as) the same thing.  He spawns the thread
(so far the same thing) but instead of just making a queue and reading from
it, he creates an object window in this thread and lets PM dispatch the
messages sent from the main thread. (Am I understanding this right?)

My question is, are these doing the same thing?  If not, what is different.
If so, why is one way better?

I apologize if this is a dumb question, but I had never heard of an object
window before.  It appears to be a cool way to extend and exploit the inherent
client-server architecture of PM.

Many, many thanks,

 
 
 

HWND_OBJECT

Post by Timur Ta » Wed, 02 Mar 1994 13:08:14


This isn't exactly my line of expertise, but I think one advantage
of a message queue based on HWND_OBJECT is that it's not attached
to the system message queue, so that your window procedure can
take as long as it likes to process a message without worrying about
whether it's typing up the mouse or keyboard.

In other words, if you create an object message queue (or whatever
it's called), it can't be used to accept mouse and keyboard messages.
--

------------------------------------------------------------------ Timur Tabi


 
 
 

HWND_OBJECT

Post by os2.. » Thu, 03 Mar 1994 05:52:33



Quote:>This isn't exactly my line of expertise, but I think one advantage
>of a message queue based on HWND_OBJECT is that it's not attached
>to the system message queue, so that your window procedure can
>take as long as it likes to process a message without worrying about
>whether it's typing up the mouse or keyboard.
>In other words, if you create an object message queue (or whatever
>it's called), it can't be used to accept mouse and keyboard messages.

This is true.  The idea of object windows is to allow for two way
communication between threads.

Cheers,
Q
--
Have you read this month's EDM/2?  Send an empty email message to

receive back issues, etc.  Send all comments, complaints, suggestions

 
 
 

HWND_OBJECT

Post by Kenton Shave » Fri, 04 Mar 1994 12:42:48




> (Keith Brafford) writes:

> >What's the difference between spawning a thread that creates a HWND_OBJECT
> >window and one that creates a Message queue?  Why would one be used over
> >another?

> Message queues are unique to threads, so your question is invalid, since -
> in order to create an object window (a window whose parent is HWND_OBJECT) -
> you have to have a message queue for that thread.

Perhaps then one thread can have multiple message queues?  I have PM
made PM programs that have multiple queues and only one thread.
Performance and process monitor analysis both confirmed only on thread
was present.  In fact, Larry, if you still have the first draft of my
CLOCK.CPP article submission, that code is an example.  The second
version of this program does not bother with message passing because I
could not figure out where the message processing loop in
IObjectWindow objects resides in order to thread it and thereby
improve performance.

KWS

 
 
 

HWND_OBJECT

Post by Kenton Shave » Fri, 04 Mar 1994 12:49:13




> >This isn't exactly my line of expertise, but I think one advantage
> >of a message queue based on HWND_OBJECT is that it's not attached
> >to the system message queue, so that your window procedure can
> >take as long as it likes to process a message without worrying about
> >whether it's typing up the mouse or keyboard.

> >In other words, if you create an object message queue (or whatever
> >it's called), it can't be used to accept mouse and keyboard messages.

Interesting.

Quote:> This is true.  The idea of object windows is to allow for two way
> communication between threads.

I thought object windows were cheifly intended to handle long
processing--specifically processing that would violate the
1/10th-of-a-second rule.  Sure, one can create separate threads to do that
but if you already have 256 threads active....

KWS

 
 
 

HWND_OBJECT

Post by os2.. » Fri, 04 Mar 1994 22:17:10



Quote:>> This is true.  The idea of object windows is to allow for two way
>> communication between threads.
>I thought object windows were cheifly intended to handle long
>processing--specifically processing that would violate the
>1/10th-of-a-second rule.  Sure, one can create separate threads to do that
>but if you already have 256 threads active....

I guess I wasn't clear enough.  Object windows are intended for threads
that need 2-way communication.  Typically, they are used for "server"
threads, but do not need to be necessarily.

Cheers,
Q
--
Have you read this month's EDM/2?  Send an empty email message to

receive back issues, etc.  Send all comments, complaints, suggestions