Delphi Services 里面Findwindow 问题
老产品维护问题,
Delphi 版本:delphi6
如果新建一个Application,
用一下Code可以获得正确的Handle
Delphi(Pascal) code:
procedure TForm1.Button1Click(Sender: TObject);
var
EVMHandle:HWND;
EVMTitle: String;
begin
EVMHandle:=FindWindow(nil,'console');
Showmessage(inttostr(EVMHandle));
end;
但如果写一个delphi service application,
返回的handle值一直是0
Delphi(Pascal) code:
procedure TSvcChkHandle.ServiceStart(Sender: TService;
var Started: Boolean);
var
EVMHandle: HWND;
begin
try
Coinitialize(nil);
EVMHandle:=FindWindow(nil,'console');
Writelog(inttostr(EVMHandle));
Started := True;
except
On E: Exception do LogMessage(E.Message);
end;
end;
console 是我一个应用程序的窗口标题
在线等,谢谢
有没有什么方法在service里面可以检查某一个应用程序是否在运行?
老的产品在service里用Findwindow 来判断应用程序是否运行,怀疑是否windows2000里面可以
,但XP或者更高版本有问题,我在网上查到很多类似问题,但还没有解决我目前问题的方法。
谢谢关注,请继续支招。
可以用 psapi 单元的 EnumProcesses 或者 toolhlp 单元的 CreateToolhelp32Snapshot, Process32First, Process32Next 来定
相关问答:
已知Python 中:
s = unicode("测试", "gb2312")
s = u'\u6d4b\u8bd5'
print s
测试
在Delphi里面如何将\u6d4b\u8bd5这样的还原成Gb2312的汉字呢?
找到个方法
......
delphi内置的加密解密单元是哪个?
Delphi有内置加密解密单元?
delphi里有个加密和解密的单元
引用
delphi里有个加密和解密的单元
是哪个?
windows的api?
标准加密的源代码,网上 ......
procedure ChangeProxy(Addr: string; Bypass, Enabled: Boolean);
var
Info: INTERNET_PROXY_INFO;
Reg : TRegistry;&nb ......
哪里有Delphi的视频教程?新手那种的
谢谢
加月亮QQ,然后让月亮跟你视频讲解,免费的视频讲解
有很多,但天下没有免费的午餐
2楼的朋友 月亮是谁?
引用
2楼的朋友 月亮是谁?
大名顶顶 ......