How to get Windows / running program handle from Process ID or Title Name
Regards, Greetings
Try FWH. You will enjoy it's simplicity and power.!
Try FWH. You will enjoy it's simplicity and power.!
How to get Windows / running program handle from Process ID or Title Name
// Purpose: Find handle of window of running application
// Else returns nil
// Author : Enrico Maria Giordano
// Date : 1/10/2005
#include "Fivewin.ch"
#define GW_HWNDNEXT 2
FUNCTION MAIN()
? FINDWND( "Carrot" )
RETURN NIL
FUNCTION FINDWND( cTitle )
LOCAL hWnd := GETFOREGROUNDWINDOW()
WHILE hWnd != 0
IF GETWINDOWTEXT( hWnd ) = cTitle
RETURN hWnd
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
RETURN NIL
DLL32 FUNCTION GETFOREGROUNDWINDOW() AS LONG;
PASCAL FROM "GetForegroundWindow" LIB "user32.dll"James Bott wrote:Try this (and thank Enrico if it works for you):
James
Sir,
I have to trap all the running program hWnd,
aTasks = GetTasks()
cErrorLog += " Windows total applications running: " + ;
AllTrim( Str( Len( aTasks ) ) ) + CRLF
for n = 1 to Len( aTasks )
cErrorLog += " " + Str( n, 3 ) + " " + aTasks[ n ] + CRLF
next