调用 WinExec 或 ShellExecute 这两个 API 去执行那个可执行文件即可(搜一下,别人对这个问题已经作了很好的解答:)
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 ); UINT WinExec( LPCSTR lpCmdLine, // address of command line UINT uCmdShow // window style for new application );
访问网站:ShellExecute(Handle,nil,PChar('http:\\WWW.DigitalNingBo.Com'),nil,nil,SW_SHOWNORMAL);
发信:ShellExecute(Handle,nil,PChar('mailto:[email protected]'),nil,nil,SW_SHOWNORMAL);
可执行文件:ShellExecute(Handle,nil,WINMINE.EXE,nil,nil,SW_SHOWNORMAL);
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
);
UINT WinExec( LPCSTR lpCmdLine, // address of command line
UINT uCmdShow // window style for new application
);