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!

How can one trigger Application 2 from Application 1? 1

Status
Not open for further replies.

terrytype

Programmer
Jun 1, 2011
97
ZA
I need to trigger Application 2 "NumbersUpdate.exe" from Application 1 "MyProg.exe".

The following initiating from "MyProg.exe" produces exception "class EInvalidPointer with message
'Invalid [pointer operation'".

WinExec('c:\Program Files\MyPrograms\NumbersUpdate.exe', SW_SHOWNORMAL);

What am I missing?

Thanks in advance for this urgently needed help.

delphiman

Old Man Delphi
 
Try something like this

Code:
procedure TriggerNumbersUpdate; 
var
   AppName: array[0..512] of char;
   path: string;
begin
   Path := '"c:\Program Files\MyPrograms\NumbersUpdate.exe"';
   FillChar(AppName, SizeOf(AppName), #0);
   StrPCopy(AppName, Path);
   ShellExecute(0, 'open', AppName, nil, nil, SW_SHOWNORMAL);
end;

if not already there, add ShellApi to your uses clause.
 
Thank you Majlumbo!

I was about to post that I had resolved my problem with the following

WinExec('c:\Program Files\MyPrograms\NumbersUpdate.exe', SW_SHOW);

You got in just ahead of me.

Haven't tried it but it seems your suggestions will work too!

Thanks again!

Old Man Delphi
 
YUP! Tried your solution. It works too! Thanks again! [2thumbsup]

Old Man Delphi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top