How to use MsgWaitForMultipleObjects ?

2 views
Skip to first unread message

Schmidt

unread,
Apr 27, 2000, 3:00:00 AM4/27/00
to
Hi,

does anyone has a code sample how to use the
MsgWaitForMultipleObjects api cmd ?
I just want to use this cmd as alternative for sleep!
I'm a beginner so please a whole code sample for Delpi.

Thanks
Thorsten

Peter Below (TeamB)

unread,
Apr 28, 2000, 3:00:00 AM4/28/00
to

Thorsten,

have you tried to search the newsgroup archives?

http://www.mers.com/searchsite.html
http://www.deja.com
http://www.tamaracka.com
http://developers.href.com

The last two seem to be a bit out of date.

Peter Below (TeamB) 10011...@compuserve.com)
No replies in private e-mail, please, unless explicitly requested!


GenJerDan

unread,
Apr 30, 2000, 3:00:00 AM4/30/00
to
On Thu, 27 Apr 2000 23:17:21 +0200, "Schmidt" <thor...@novelsoft.com>
wrote:

>does anyone has a code sample how to use the
>MsgWaitForMultipleObjects api cmd ?
>I just want to use this cmd as alternative for sleep!
>I'm a beginner so please a whole code sample for Delpi.

This was just yanked out of an app, and might give you an idea of the
syntax and such:


VAR
TSI : TStartupInfo;
TPI : TProcessInformation;
Ret : integer;
Msg,
CmdLine,
SRcDir : string;
Begin
SrcDir := edtTemp.Text;
AssignFile(Err,SrcDir+'\server.log');
Rewrite(Err);
frmWait.Show;
CmdLine :='\msdex86.exe -s -a -f1 "'+edtTemp.Text+'\unattend.iss"';
FillChar(TSI,SizeOf(TSI),0);
TSI.CB := SizeOf(TSI);
IF NOT CreateProcess(nil,PChar(CmdLine),nil,nil,False,
NORMAL_PRIORITY_CLASS,nil,nil,TSI,TPI) THEN
Begin
Msg := SysErrorMessage(GetLastError);
MessageBox(0,PChar(Msg+#13#10+CmdLine),'Error',mb_OK);
End
ELSE
Begin
Application.ProcessMessages;
REPEAT
Screen.Cursor := crHourGlass;
ret := MsgWaitForMultipleObjects(1, TPI.hProcess,
false, INFINITE,
(QS_POSTMESSAGE Or
QS_SENDMESSAGE));
if ret <> (WAIT_OBJECT_0) then
Application.ProcessMessages;
UNTIL ret = (WAIT_OBJECT_0);
Screen.Cursor := crDefault;
CloseHandle(TPI.hProcess);
End;
End;


Daniel J. Wojcik
****************
There is water at the bottom of the ocean.

http://www.genjerdan.com
programming, and other things best done in private

Craig Stuntz

unread,
May 2, 2000, 3:00:00 AM5/2/00
to
Schmidt wrote:
>
> does anyone has a code sample how to use the
> MsgWaitForMultipleObjects api cmd ?

There's a really good discussion at:

http://www.exe.co.uk/articles/articlepull.asp?page=apr00/launch.html

-Craig

--
Craig Stuntz Vertex Systems Corporation
Senior Developer http://www.vertexsoftware.com

Reply all
Reply to author
Forward
0 new messages