Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run and then close an external application from my application.

Status
Not open for further replies.

AtcBrambo

Programmer
May 7, 2010
4
IT
Hi. It may look my question is already in the FAQ. But it is not.
I need to open (i.e.) a pdf file.
I would use (Ctrl C Ctrl V from FAQ)

iHandle:=ShellExecute(0, 'Open', PChar('c:\ADoc.pdf'), PChar(''), PChar(''), SW_Hide);
The returned value "is said" to be the handle.
If so, I would then use
PostMessage( iHandle, WM_CLOSE, 0 , 0);
But it doesn't work.

Instead, if I use PostMessage( Form1.Handle , WM_CLOSE, 0 , 0);
it works perfectly.

Do you have suggestions ?

Thanks in advance.
Giovanni
Italy.

 
you can embed the pdf file into your application.
Use a TOLEContainer in a form.

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
No. This was an example. The user may need to have a preview with tens of different files!!!
That's why I need to ave control over previews!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top