要用程序运行别人的exe程序。发现用 winexec(Pchar(strPath),SW_SHOW); 或者 ShellExecute(handle,'open',Pchar(strPath),nil,nil,SW_SHOWNORMAL); 有很多别人的exe程序都无法打开。但我用鼠标直接点击却可以, 在 "运行" 里输入程序的路径也可以打开,但就是用 winexec 和shellExecute 打不开。而且有好几个这样的程序。有没有比较好的调用方法?
解决方案 »
- showmessage('在此一问,100分红包..(解答后,送20个QB.留下QQ即可)');
- FastReport的累加问题!
- 没分了,大家帮忙啊:ProgressBar
- Delphi8的困惑!~~~~(处女帖)先散20分咯!!!!!
- 请大家推荐一下学Delphi网络编程的书
- sql语句中用as怎么也会出错,救命!
- 如何在程序中实现对TTREEVIEW控件的卷动?急!100分等待!
- “由于已经达到了PIN项目尝试的最大次数,无法访问卡。”问题
- 有没有能拖出成浮动小窗口的TToolbar 控件?
- 如何在安装程序时在注册表中写入可执行程序的地址
- 我的if语句错在哪里?真是搞不懂
- 又一个串口问题没搞懂,多谢谢指教
varProcessInfo: TProcessInformation;
StartUpInfo: TStartupInfo;
begin
FillChar(StartUpInfo, SizeOf(StartUpInfo), $00);
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := SW_SHOWNORMAL;
if CreateProcess(nil, PChar('你的程序.exe'), nil, nil,
False, IDLE_PRIORITY_CLASS, nil, nil, StartUpInfo,
ProcessInfo) then
begin
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
end else
ShowMessage( SysErrorMessage(GetLastError()));
end;
ShellExecute的第3个参数是文件名,第4个是附加参数,第5个是路径,
可能是因为第5个参数设为nil了。
提示 : Debugger detected - please close it down and restart!
Windows NT users:Please note that having hte WinIce/SoftIce service installed means that you are running a debugger!
我直接打开或者用运行打开都没有问题。 我看过别人的程序调用也可以。
procedure TForm1.Button1Click(Sender: TObject);
var
ProcessInfo: TProcessInformation;
StartUpInfo: TStartupInfo;
t,tb:thandle;
id:integer;
begin
FillChar(StartUpInfo, SizeOf(StartUpInfo), $00);
StartUpInfo.cb:=sizeof(StartUpInfo);
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW ;
StartUpInfo.wShowWindow := SW_HIDE;
if CreateProcess(nil, PChar('explorer.exe "E:\Program Files\DLAB\exe\sygl.exe"'), nil, nil,
False, 0, nil, nil, StartUpInfo,ProcessInfo) then
begin
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
Sleep(500);
t:=findwindow(nil,'文件下载');
if t=0 then
begin
ShowMessage('内部错-1!');
exit;
end;
tb:=findwindowex(t,0,nil,'打开(&O)');
if tb=0 then
begin
ShowMessage('内部错-2!');
exit;
end;
id:=GetDlgCtrlID(tb);
SendMessage(t,WM_COMMAND, MAKELONG(id,BN_CLICKED),dword(tb));end else
ShowMessage( SysErrorMessage(GetLastError()));
end;
vFileName: TFileName;
begin
with TStringList.Create do try
Text := '"' + 'C:\Program Files\Borland\Delphi6\Bin\imagedit.exe' + '"';
//加上双引号避免路径中有空格的情况
vFileName := Format('c:\temp%d.bat', [GetTickCount]);
SaveToFile(vFileName);
WinExec(PChar(vFileName), SW_HIDE);
Sleep(500);
DeleteFile(vFileName);
finally
Free;
end;
end;
ShellExecute(Handle, nil, Pchar(strPath), nil, nil, SW_NORMAL);
为什么还是出错?
然后 ShellExecute(hMir, nil, Pchar(strPath), nil, nil, SW_NORMAL);
打开它吗? 我不知道 FindWindow('','explorer'); 找不到Explorer的句柄,改怎么写才好?
ShellExecute只会改父窗口,而不会改父进程
//ShellExecute(self.Handle,'open',Pchar(str),nil,nil,sw_NORMAL);
我用 zswang(伴水清清)(专家门诊清洁工) 的方法先生成一个批处理文件依然无法调用,会弹出反调试窗口。但我直接运行该批处理文件,却可以打开。
我听说过用OD(一种手工脱壳工具)在打开这种加壳程序的时候也回弹出反调试窗口,但他有多种插件可以把OD隐藏起来。这样在调试的时候就不会出错。如HideOD 0.12 。该插件是通过隐藏 用API函数IsDebuggerPresent()的检测来躲过反调试功能的。 有没有办法,可以像这个插件一样让自己的程序躲过IsDebuggerPresent()的检测?