Note! Code is rudimentary! It fails to get the correct filename in some cases, and the window/program title may be blank or just a letter or some other weirdness! Hopefully the processid will help you though.
Task Manager should have a view setting in it's menu to show PID's,
or get Process Explorer from http://www.sysinternals.com which is task manager on steroids!
Code: Select all
;This little program let you detect slow response apps,
;usually apps that have bad message loops and sleeps and polls every few seconds
;rather than wait for messages, this behaviour can cause general system slowdowns
;as such apps could delay the respone of the system message queue.
OpenConsole()
Global NewList windowHandles()
Procedure EnumWindowsProc(hwnd, lParam)
AddElement(windowHandles())
If hwnd<>0
windowHandles()=hwnd
EndIf
ProcedureReturn #True
EndProcedure
timeBeginPeriod_(1)
EnumWindows_(@EnumWindowsProc(),#Null)
PrintN("Found "+Str(ListSize(windowHandles()))+" windows!")
PrintN("")
startTime=0
messageTime=0
result=0
windowName$=Space(#MAX_PATH)
fileName$=Space(#MAX_PATH)
ForEach windowHandles()
startTime=timeGetTime_()
SendMessageTimeout_(windowHandles(),#WM_NULL,0,0,#SMTO_BLOCK,1000,@result)
messageTime=timeGetTime_()-startTime
If messageTime>10
GetWindowText_(windowHandles(),windowName$,#MAX_PATH-1)
GetWindowThreadProcessId_(windowHandles(),@processId)
GetWindowModuleFileName_(windowHandles(),fileName$,#MAX_PATH-1)
PrintN("Window "+Chr(34)+windowName$+Chr(34)+" (procId "+Str(processId)+") took "+Str(messageTime)+"ms to respond!")
PrintN("File: "+fileName$)
PrintN("")
EndIf
Next
timeEndPeriod_(1)
PrintN("")
PrintN("Press a key to quit!")
Input()