我想问下我有没有什么办法用一个程序去判断 另一个程序运行是否卡住了?
就是半天没反应,有可能一会又反应过来了我是模拟操作用的,有时候那个程序会出现卡住半天,有可能就死了,有可能又活过来了?如何去判断?
就是半天没反应,有可能一会又反应过来了我是模拟操作用的,有时候那个程序会出现卡住半天,有可能就死了,有可能又活过来了?如何去判断?
解决方案 »
- 求购D7+SQL2K开发的印刷业小型ERP(要求内详细)
- listview里面的item拖动
- 有关Excel的疑问?几个问题!谢谢
- 请问: 如何确定一个ACCESS的*.mdb数据库文件的版本号,另外,一个ACCESS的*.mdb数据库文件的版本号与msjet的版本号有何关系?
- 关于ADO连接ACCESS数据库及其操作的问题!!多多帮忙啊
- 高难度关于Filter ??
- 要求能够自定义字段和查询内容的动态报表要怎么做最容易呢???
- 神奇的问题!
- mmboy(雨过天晴)请进来拿分!--->“急,关于报表的,无论高手低手都一律请入,分数陆续会加到600分!分数必分,决不食言!(VB转Delphi者求助!)”(little_hero)
- 如何使用Delphi编写用ADO访问数据库并返回一个记录集的COM,并通过ASP来调用这个COM来显示数据
- 求Delphi程序
- DELPHI 读取所有编码的文本文件
还有一种办法。
function IsAppRespondig9X(dwThreadId: DWORD): Boolean;
type
TIsHungThread = function(dwThreadId: DWORD): BOOL; stdcall;
var
hUser32: THandle;
IsHungThread: TIsHungThread;
begin
Result := True;
hUser32 := GetModuleHandle('user32.dll');
if (hUser32 > 0) then
begin
@IsHungThread := GetProcAddress(hUser32, 'IsHungThread');
if Assigned(IsHungThread) then
begin
Result := not IsHungThread(dwThreadId);
end;
end;
end;
function IsAppRespondigNT(wnd: HWND): Boolean;
type
TIsHungAppWindow = function(wnd:hWnd): BOOL; stdcall;
var
hUser32: THandle;
IsHungAppWindow: TIsHungAppWindow;
begin
Result := True;
hUser32 := GetModuleHandle('user32.dll');
if (hUser32 > 0) then
begin
@IsHungAppWindow := GetProcAddress(hUser32, 'IsHungAppWindow');
if Assigned(IsHungAppWindow) then
begin
Result := not IsHungAppWindow(wnd);
end;
end;
end;
function IsAppRespondig(Wnd: HWND): Boolean;
begin
if not IsWindow(Wnd) then
begin
ShowMessage('Incorrect window handle!');
Exit;
end;
if Win32Platform = VER_PLATFORM_WIN32_NT then
Result := IsAppRespondigNT(wnd)
else
Result := IsAppRespondig9X(GetWindowThreadProcessId(Wnd,nil));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Res: DWORD;
h: HWND;
begin
h := FindWindow(nil, 'notepad');
if h > 0 then
begin
if IsAppRespondig(h) then
ShowMessage('notepad 有响应')
else
ShowMessage('notepad 无响应');
end
else
ShowMessage('未打开 notepad');
end;
发消息
管道
socket
共享内存
等等