Alistair,

You realise that you must use ShellExecuteEx, pass it the SHELLEXECUTEINFO
record and get the process handle (hProcess) from the record.  The return
value of ShellExecute is a HINSTANCE - it is not a process handle.

Furthermore, you should not use WAITINFINITE because if the email program
hangs, so will your registration program - use a timeout value - then check
with the user (eg. have you sent the email yet?), then wait some more.  Give
the user to cancel if the email program hangs, etc.

Another thought, executing "mailto:" could fire up the browser, and the
browser could then spawn the emailer, in which case, WaitForSingleObject
will not work.  You might want to try and experiment with SMTP / MAPI
components sending email (ie, bypass the default email program).

-----------------------------------------------------
Dennis Chuah, BE (Hons) [mailto:[EMAIL PROTECTED]]
Manager, Product Development
Contec Data Systems Ltd. [http://www.contecds.com]
tel: +64-3-3580060 ext-775 fax: +64-3-3588045

> Actually, my call to Execute file is a morph of ShellExecute, so
> it returns
> a handle:
> myhandle:=ExecuteFile('mailto:[EMAIL PROTECTED]?subject='+regstring, '',
> '',SW_SHOWNOACTIVATE);
> while (waitforsingleobject(myhandle,infinite)=WAIT_OBJECT_0)
> and not(escape) do application.ProcessMessages;
> Application.HelpJump('OnlineOrder');
>
> Unfortunately, the handle of the mail object remains unchanged after the
> send button is pressed - maybe it is due to the mail being
> outstanding - it
> should not be forced to be sent.
> Any other ideas, or am I missing something?
> thanks,
> Al+
> > If you use ShellExecute, you can get hold of the process
> handle, then use
> > WaitForSingleObject.  What the function returns, the process is done.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to