//eg:ConnectToInternet('C:\Temp');
//eg:ConnectToInternet('http://www.sina.com');function ConnnectToInternet(Addr:String):Integer;
var
Rslt:LongBool;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation ;
IEPath:array [0..MAX_PATH] of Char;
IEName:String;
begin
GetWindowsDirectory(IEPath,MAX_PATH);
IEName:=IEPath+'\Explorer.exe '+Addr;
FillChar(StartupInfo,sizeof(TStartupInfo),0);
with StartupInfo do
begin
cb:=sizeof(TStartupInfo);
dwFlags:=STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
wShowWindow:=SW_MAXIMIZE;
end;
Rslt:=CreateProcess(nil,Pchar(IEName),nil,nil,false,
NORMAL_PRIORITY_CLASS,nil,nil,StartupInfo,ProcessInfo);
if Rslt then
with ProcessInfo do
begin
WaitForInputIdle(hProcess,INFINITE);
CloseHandle(hThread);
CloseHandle(hProcess);
Result:=0;
end
else Result:=GetLastError;
end;
//eg:ConnectToInternet('http://www.sina.com');function ConnnectToInternet(Addr:String):Integer;
var
Rslt:LongBool;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation ;
IEPath:array [0..MAX_PATH] of Char;
IEName:String;
begin
GetWindowsDirectory(IEPath,MAX_PATH);
IEName:=IEPath+'\Explorer.exe '+Addr;
FillChar(StartupInfo,sizeof(TStartupInfo),0);
with StartupInfo do
begin
cb:=sizeof(TStartupInfo);
dwFlags:=STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
wShowWindow:=SW_MAXIMIZE;
end;
Rslt:=CreateProcess(nil,Pchar(IEName),nil,nil,false,
NORMAL_PRIORITY_CLASS,nil,nil,StartupInfo,ProcessInfo);
if Rslt then
with ProcessInfo do
begin
WaitForInputIdle(hProcess,INFINITE);
CloseHandle(hThread);
CloseHandle(hProcess);
Result:=0;
end
else Result:=GetLastError;
end;
解决方案 »
- delphi 改变外部程序的位置,大小
- TClientDataSet老提示不在编辑状态真是见鬼了
- 向各位大虾请教一个tword组件问题
- delphi 基础用法讨论请行伍出身的来看看,本人半路出家。
- Delphi 下也可以屏蔽Win200、WinXP、Windows Server 2003下的Ctrl + Alt + Del组合键了
- 如何让已处于运行阶段的执行程序不再让它重复运行且恢复原窗口大小并置最前端?
- Object Pascal中局部对象的问题
- 如何对adoquery数据集中的数据进行排序?
- 我的收机不能发短消息
- 本月累计
- visibroker是什么东西.有什么用处?
- 急!三层结构问题!大家帮帮忙不然就不能回家了!
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", path_to_folder, NULL, NULL, SW_SHOWNORMAL);
To explore a folder, use the following call:ShellExecute(handle, "explore", path_to_folder, NULL, NULL, SW_SHOWNORMAL);
If lpOperation is NULL, the function opens the file specified by lpFile. If lpOperation is "open" or "explore", the function will force an open window or explorer.