var StartInf:TSTARTUPINFO; ProInf:TProcessInformation; ExeName:string; begin StartInf.cb := SizeOf(TSTARTUPINFO); ExeName := 'C:\***.exe'; //your exe Name CreateProcess( Pchar(ExeName),'',nil,nil,FALSE, CREATE_DEFAULT_ERROR_MODE, nil, nil, StartInf, ProInf); end;关闭此进程 TerminateProcess(ProInf.hProcess,0);
好象不太管用,可能要用shell,能否谈谈shell?
用ShellExecute试试看? HINSTANCE ShellExecute( HWND hwnd, // handle to parent window LPCTSTR lpOperation, // pointer to string that specifies operation to perform LPCTSTR lpFile, // pointer to filename or folder name string LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters LPCTSTR lpDirectory, // pointer to string that specifies default directory INT nShowCmd // whether file is shown when opened );
用ShellExecute试试看? ShellExecute(handle, 'Open', 'U Program Here', 'Parameters Hers', nil, SW_SHOW);
StartInf:TSTARTUPINFO;
ProInf:TProcessInformation;
ExeName:string; begin
StartInf.cb := SizeOf(TSTARTUPINFO);
ExeName := 'C:\***.exe'; //your exe Name
CreateProcess( Pchar(ExeName),'',nil,nil,FALSE,
CREATE_DEFAULT_ERROR_MODE,
nil,
nil,
StartInf,
ProInf);
end;关闭此进程
TerminateProcess(ProInf.hProcess,0);
HINSTANCE ShellExecute(
HWND hwnd, // handle to parent window
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename or folder name string
LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened
);
ShellExecute(handle, 'Open', 'U Program Here', 'Parameters Hers', nil, SW_SHOW);