Board index » cppbuilder » MsgWaitForMultipleObjects

MsgWaitForMultipleObjects


2005-08-08 03:13:45 PM
cppbuilder30
I'm interested to know whether I can override the default message loop.
I'm trying to use MsgWaitForMultipleObjects() in my application. Which hook
or method can I override?
 
 

Re:MsgWaitForMultipleObjects

"tinyabs" < XXXX@XXXXX.COM >wrote in message
Quote
I'm interested to know whether I can override the default message loop.
That depends on whether you are using the VCL are not. If so, then no.
TApplication::Run() is required as it does things internally that you do not
have access to.
What EXACTLY do you want to accomplish?
Quote
I'm trying to use MsgWaitForMultipleObjects() in my application.
What does that have to do with overriding the message loop?
Gambit
 

Re:MsgWaitForMultipleObjects

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"tinyabs" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>I'm interested to know whether I can override the default message loop.

That depends on whether you are using the VCL are not. If so, then no.
TApplication::Run() is required as it does things internally that you do
not
have access to.

What EXACTLY do you want to accomplish?

>I'm trying to use MsgWaitForMultipleObjects() in my application.

What does that have to do with overriding the message loop?


Gambit


I had a pipe client communicating with a service app. I'm redirecting pipe
byte messages into the WndProc as WM events. Currently, I use PostMessage()
and pipe->GetMessage() to redirect the pipe messages.
 

{smallsort}

Re:MsgWaitForMultipleObjects

MsgWaitForMultipleObjects is used only when you are waiting an message
and an synchronizable object to be signaled.
If you don't have synchronizable object to wait don't use
MsgWaitForMultipleObjects.
Tales Aguiar.
"tinyabs" < XXXX@XXXXX.COM >wrote in message
Quote

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
news:42f78d85$ XXXX@XXXXX.COM ...
>
>"tinyabs" < XXXX@XXXXX.COM >wrote in message
>news: XXXX@XXXXX.COM ...
>
>>I'm interested to know whether I can override the default message loop.
>
>That depends on whether you are using the VCL are not. If so, then no.
>TApplication::Run() is required as it does things internally that you do
>not
>have access to.
>
>What EXACTLY do you want to accomplish?
>
>>I'm trying to use MsgWaitForMultipleObjects() in my application.
>
>What does that have to do with overriding the message loop?
>
>
>Gambit
>
>
I had a pipe client communicating with a service app. I'm redirecting pipe
byte messages into the WndProc as WM events. Currently, I use
PostMessage()
and pipe->GetMessage() to redirect the pipe messages.


 

Re:MsgWaitForMultipleObjects

"tinyabs" < XXXX@XXXXX.COM >wrote in message
Quote
I had a pipe client communicating with a service app. I'm redirecting
pipe byte messages into the WndProc as WM events. Currently, I
use PostMessage() and pipe->GetMessage() to redirect the pipe messages.
What does that have to do with overriding the message loop, though? You
don't need to. Simply override the WndProc() method in your TForm, or use a
MESSAGE_MAP, in order to process the messages as they arrive.
Gambit
 

Re:MsgWaitForMultipleObjects

I'm waiting on named pipe and WM messages.
 

Re:MsgWaitForMultipleObjects

okey, you can do it, but you need know.. you will be lose some VCL features
like TThread::Sinchornize function and TApplication::OnIdle event...
The ReadFile and WriteFile have an parameter (lpOverlapped) that you can
specity an event. When has data to read or when write operation finish this
event is signaled. Use the overlapped param to know when have data to read.
On call MsgWaitForMultipleObjects do like it...
DWORD reason = MsgWaitForMultipleObjects(1, &OverlappedStructure, false,
INFINITE, QS_ALLINPUT );
if (reason == WAIT_OBJECT_0)
// read complete
else
if (reason == WAIT_OBJECT_0 + 1)
Application->ProcessMessages()
else
...
I hope be useful,
Sorry by my bad english
Tales Aguiar
"tinyabs" < XXXX@XXXXX.COM >wrote in message
Quote
I'm waiting on named pipe and WM messages.


 

Re:MsgWaitForMultipleObjects

That's what I intended to do, just to optimize the current code abit. I
guess I'm better off using a TThread object and then Synchronize() it.