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

Problem with ShellExecute 2

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I'm trying to create a small console app that runs a batch file and sends a resulting text file via email. At this point, I'm trying to get the ShellExecute command to run and I always get
[tt]Error: Undeclared identifier: 'Handle'[/tt]

Here's the entire code:
Code:
[navy][i]// for automatic syntax highlighting see faq102-6487 
[/i][/navy][b]program[/b] MVD_FTP;

[navy][i]{$APPTYPE CONSOLE}[/i][/navy]

[b]uses[/b]
  Windows, SysUtils, ShellAPI;

[b]begin[/b]
  ShellExecute(Handle, [teal]'open'[/teal], PChar([teal]'\\fileandprint\groups\InfoTech\FTP2DMV\Startdmv.bat'[/teal]), [b]nil[/b], [b]nil[/b], SW_SHOW);
[b]end[/b].


What do I need to add so that Handle is not an undeclared identifier? I've never had an issue with this before, but I've never done a console app either.

Any ideas/suggestions?

Thanks!
Leslie
 
easy :

Handle is in fact TForm.Handle.

since you are in a console application, you have no form and hence no handle. just replace Handle with 0 and all should be fine.

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top