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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call another app

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I have a Delphi application, ReportGenerator, that is normally called from an AS400/RPG program (another developer does the RPG programming, I don't have a clue how that's all done!). The ReportGenerator has several parameters that are passed in from the calling program.

I have now developed another Delphi program that needs to call the ReportGenerator. Would I use the ShellExecute command to call ReportGenerator? How would I pass the parameters?

Thanks for any insight!

Leslie
 
I've always used ShellExecute to open a separate program, yes.

Here's the MSDN listing for the ShellExecute command:

HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);


I went back to one of my programs that uses it, and the parameters do match in number and, for the operation and file, in type. I'm afraid I've never had to pass parameters into a program, so I sadly can't help you with the structuring of the parameters list.

Hope this helps some.
 
It's actually part of the ShellExecute. The lpParameters is a list of the parameters. I ended up with :

Code:
ShellExecute(Handle, 'open', PChar('\\Fileandprint\apps\Case Management\ReportGenerator\ReportGenerator.exe'),
                [b]PChar(' 20 ' + fBIMain.sCasPre + ' ' + IntToStr(fBIMain.iCasNum) + ' ' + dm_Interview.sUserID + ' N 1 I 1')[/b], nil, SW_SHOW);

The bolded section is my list of parameters, works just fine!

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
thanks, aaron, I had found that but it didn't specifically address what I was trying to do...
 
Leslie,

There are a couple of Delphi FAQs which cover this. Have you looked at them?

faq102-5462

and

faq102-6048





Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top