با سلام
چطور میشه در ویندوز 10 64 بیت فهمید که یک برنامه هنگ (Not Responding) کرده؟
با سلام
چطور میشه در ویندوز 10 64 بیت فهمید که یک برنامه هنگ (Not Responding) کرده؟
سلام. بهش مسیج میدید اگر پاسخی نداد هنگ است.
فرض بر اینه که برنامه رو خودتون نوشته باشید و پاسخ مناسبی برای مسیج مزبور بدهید.
توابع تبدیل تاریخ با دقت 5000 سال
پذیرش پروژه، کامپوننت، آموزش برنامه نویسی (دلفی، اس کیو ال، ..) -> 09123780840
دوستای گلم حمایت کنید : https://cafebazaar.ir/app/com.nikanmehr.marmarxword/
نرم افزار پخش مویرگی
ممنون از پاسختون
من میخوام هر برنامهای رو بتونم کنترل کنم و محدود به برنامههای خودم نباشه.
یه کدهایی تو نت پیدا کردم ولی در ویندوز ۱۰ ۶۴بیت کار نکرد. دستور sendMessageTimeout
من این کد رو دارم
function AppIsResponding(ClassName: string): Boolean;
const
{ Specifies the duration, in milliseconds, of the time-out period }
TIMEOUT = 50;
var
Res: DWORD;
h: HWND;
begin
h := FindWindow(PChar(ClassName), nil);
if h <> 0 then
Result := SendMessageTimeOut(H,
WM_NULL,
0,
0,
SMTO_NORMAL or SMTO_ABORTIFHUNG,
TIMEOUT,
Res) <> 0
else
ShowMessage(Format('%s not found!', [ClassName]));
end;
ولی نمیدونم چطور باید کلاس فایل exe رو پیدا کنم.
اگه کسی در این زمینه میتونه راهنمایی کنه ممنون میشم.
// For Win9x/me
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;
// For Win NT/2000/XP
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 ('recorct window handle! ');
Exit;
End;
If win32platform = ver_platform_win32_nt then
Result := isapprespondignt(WND)
Else
Result := isapprespondig9x(getwindowthreadprocessid (WND, nil ));
End;
// Example: Check if word is hung/responding
procedure TForm1.Button1Click(Sender: TObject);
VaR
Res: DWORD;
H: hwnd;
Begin
// Find word by classname
H := findwindow (pchar('App'), nil );
If H <> 0 then
Begin
If isapprespondig(h) then
Showmessage ('App is responding! ')
Else
Showmessage ('App is not responding! ');
End
Else
Showmessage ('App is not open! ');
End;