Problems with WaitForSingleObjectEx()
Posted on 2000-03-27
I am writing a quick app to launch in the auto-run on a CD.
First of all it tests to see if Acrobat Reader is installed by checking if a registry key exists. If true, then it will just launch the "Contents.pdf" file.
If not a message box appears & if OK is selected will launch the reader's setup program.
What I want to do is wait for the setup to finish, THEN launch the "Contents.pdf" file.
I have tried using the WaitForSingleObjectEx() function but it returns immeidiatly.
Any ideas please. Here is my code,
It is written on BCB4 using the VCL for the TRegistry Object:
TRegistry *Reg = new TRegistry;
char Instructions="\"Adobe Acrobat Reader\" does not appear to be installed on your computer.\nClick 'OK' to install the latest version of the reader.\nIf you click 'Cancel' you will not be able to view the contents of this CDROM.\n";
Reg->RootKey = HKEY_LOCAL_MACHINE;
if(IDOK == MessageBox(Application->Handle,Instructions,"Renault Technical Manual CDROM",MB_OKCANCEL))
ar40engHandle = ShellExecute(Application->Handle, "open", "Ar40eng.exe", NULL, NULL, SW_NORMAL);
ar40engHandle, // handle of object to wait for
INFINITE, // time-out interval in milliseconds
false // return to execute I/O completion routine if TRUE
ShellExecute (Application->Handle, "open", "Contents.pdf", NULL, NULL, SW_NORMAL);