本人用DELPHI 5.0建立控制台程序(由File|New通过New Items窗口的New页的Console Application建立project)。在project中用ShellExecute调用外部EXE程序。例程中ShellExecute函数中外部EXE程序的句柄Handle是由parent window给出的Form1.Handle,然而Console Application建立的project中没有窗体,那么ShellExecute函数中外部EXE程序的句柄--应该如何给出?请诸位高手赐教!
(希望写出简易代码!)
(希望写出简易代码!)
shellexecute(0, ...)这个句柄是指定接收调用程序的错误对话框的窗口,一般没什么用。
例如:
procedure TForm1.Button1Click(Sender: TObject);
var
han: THandle;
begin
han :=LoadLibrary('C:\WINDOWS\EXPLORER.EXE');
ShellExecute(han, nil, PChar('C:\WINDOWS\EXPLORER.EXE'), nil, nil, SW_SHOWNORMAL);
end;
ShellExecute(handle,nil,'c:\project1.exe',nil,nil,SW_SHOWNORMAL);
系统提示[Error] Project1.dpr(7): Undeclared identifier: 'handle'
请问如何解决?