“该文件”是你写的还是其他人写的?
“运行状态”具体指什么?
简单点可以用findwindow去找目标程序的窗口类、名,找到了就发送wm-close,找不到就运行;
“运行状态”具体指什么?
简单点可以用findwindow去找目标程序的窗口类、名,找到了就发送wm-close,找不到就运行;
解决方案 »
- 没有找到qtintf70.dll ???
- 如何得到指定database中所有的数据库名?
- Unit RzCommon was compiled with a different version of Graphics.clMenuBar
- 为什么我的IdTCPClient传输文件后文件的内容不一样的,但大小却没有变化!
- 数据查找问题
- 如何把标注文字加在条形码的下面??
- 见鬼了,每次点击 DBNavigator的Refresh 按钮就出错。
- 3000元的薪水还不能满足我,为了5000元而放弃目前的工作,等于一场空,我该怎么做?
- 昨天的分已放,今天继续放分,直到学校和我签合同为止~~~
- 本地sql server 对internet sqlserver合并复制问题
- 声卡音量
- 我用Delphi调用一个VC写的dll出错!求助!!
然后findwindows,跟他发送关闭消息
找它, 如果没有, 就是运行完了. 用terminateprocess来关闭
等待运行结束:
function WinExecAndWait32(FileName:String; Visibility : integer):integer;
var
zAppName:array[0..512] of char;
zCurDir:array[0..255] of char;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
begin
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);
FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb := Sizeof(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := Visibility;
if not CreateProcess(nil,
zAppName, { pointer to command line string }
nil, { pointer to process security attributes }
nil, { pointer to thread security attributes }
false, { handle inheritance flag }
CREATE_NEW_CONSOLE or { creation flags }
NORMAL_PRIORITY_CLASS,
nil, { pointer to new environment block }
nil, { pointer to current directory name }
StartupInfo, { pointer to STARTUPINFO }
ProcessInfo) then Result := -1 { pointer to PROCESS_INF }
else begin
WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess,Result);
end;
end;
var H:Hwnd;
begin
h:=Findwindow('SciCalc','计算器');
if h=0 then
winexec('Calc',SW_RESTORE) else
begin
// SetForegroundWindow(h);
// showwindow(h,SW_RESTORE);这本来是把计算器提到前台的;
sendmessage(h,wm_close,0,0); //改成关闭也没问题;
end;
//SendMessage(FindWindow('SciCalc','计算器'),WM_SETTEXT,0,Integer(PChar('这当然不是我做的计算器,不过我可以给它起一个我喜欢的名字')));
end;
findwindow() 第一个 参数是什么 我不明白?
而 SciCalc 是 什么啊?
为什么不能改啊?
第二个是 什么?
BorlandSocktServer 第一个 参数是什么啊?
窗口类:FindWindow('窗口类',nil);
标题:FindWindow(nil,'标题');
Calc 的类名 是SciCalc >
而我 如何 具体 获得 应用程序的类名啊?
比如 我用delphi 编的 程序 类名 是什么
还有 记事本的 类名是是什么啊?
执行 应用程序好象 没有用路径 就可以找到这是为什么?
如果这个 问题解决了 非常感谢 !
如果缺工具,我可以给你一个查类名,caption属性,父窗口等等的好工具。
发短信或EMAIL:[email protected]