The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: TNick on June 17, 2006, 12:41:51 PM

Title: MsgWaitForMultipleObjects
Post by: TNick on June 17, 2006, 12:41:51 PM
I don't understand the return value: <<WAIT_OBJECT_0 + nCount>> for this function. I read Win32SDK Help, and it say: "Input of the type specified in the dwWakeMask parameter is available in the thread's input queue."

Please, someone, tell me when will this function return this value?
Title: Re: MsgWaitForMultipleObjects
Post by: Casper on June 17, 2006, 05:09:09 PM
Casper says ...

You need to read more, it says ...

QuoteThe WaitForMultipleObjects function returns when one of the following occurs:

·   Either any one or all of the specified objects are in the signaled state.
·   The time-out interval elapses.

Don't use INFINITE, by the way or it will wait forever.  In the topic you were reading in the help file you should have clicked the WaitForMultipleObjects link near the top to take you to that topic.

Title: Re: MsgWaitForMultipleObjects
Post by: TNick on June 17, 2006, 06:28:52 PM
I read an example file for using DirectX in wich WaitForMultipleObjects was used, with INFINITE, for a single object. There, this function was used to get an MediaEvent. After the function returns, the result is tested against WAIT_OBJECT_0 and WAIT_OBJECT_0 +1. I only try to understand the statements ...


... like this:

    invoke   MsgWaitForMultipleObjects,1,addr event,FALSE,INFINITE,QS_ALLINPUT
       test eax,eax            ; WAIT_OBJECT_0
       jz pump_media_event

                    dec eax                 ; WAIT_OBJECT_0+1
       jz pump_message

       jmp pump

and yes, I AM reading more.
Title: Re: MsgWaitForMultipleObjects
Post by: Casper on June 17, 2006, 08:34:32 PM
Good job, reading is monumental.

Casper