Running Windows Informations (Windows)
Posted: Fri Jan 08, 2010 2:56 pm
I tried to get the best method to identify any running process but I just came to conclusion
that no of any method I tried is perfect
Here you will get
1-Window Handle
2-Window Caption Text
3-Window Class Name
4-Window Style
for parent and child too
I found for ex. that control panel and programs and features and system for win 7 have the same Window Class Name
For test run any prog. then run this code and point the mouse cursor to the running application caption
Wait for few seconds and you will get the informations
Please try and comment
Have fun
that no of any method I tried is perfect
Here you will get
1-Window Handle
2-Window Caption Text
3-Window Class Name
4-Window Style
for parent and child too
I found for ex. that control panel and programs and features and system for win 7 have the same Window Class Name
For test run any prog. then run this code and point the mouse cursor to the running application caption
Wait for few seconds and you will get the informations
Please try and comment
Code: Select all
WindowText$ = Space(100)
ClassName$ = Space(100)
ParentWindowText$ = Space(100)
ParentClassName$ = Space(100)
ModuleFileName$ = Space(255)
While a <> 100
a = a + 1
GetCursorPos_(@cp.point) ; Get cursor position
hWndOver = WindowFromPoint_(cp\y << 32 + cp\x) ; Get window cursor is over
Delay(50)
Wend
If hWndOver <> hWndLast ; If changed update display
hWndLast = hWndOver ; Save change
MessageRequester("Window Handle: ","Window Handle : "+Str(hWndOver)) ; Display window handle
r = GetWindowText_(hWndOver, @WindowText$, 100) ; Window text
MessageRequester("Window Text: ","Window Text : "+Left(WindowText$, r))
r = GetClassName_(hWndOver, @ClassName$, 100) ; Window Class
MessageRequester("Window Class Name: ","Window Class Name : " + Left(ClassName$, r))
lWindowStyle = GetWindowLong_(hWndOver, #GWL_STYLE) ; Window Style
MessageRequester("Window Style: " ,"Window Style : " + Str(lWindowStyle))
; Get handle of parent window:
hWndParent = GetParent_(hWndOver)
; If there is a parent get more info:
If hWndParent <> 0
; Get ID of window:
wID = GetWindowLong_(hWndOver,#GWL_ID)
MessageRequester("Window ID Number : ","Window ID Number : " + Str(wID))
MessageRequester("Parent Window Handle : ","Parent Window Handle : " + Str(hWndParent))
; Get the text of the Parent window:
r = GetWindowText_(hWndParent, @ParentWindowText$, 100)
MessageRequester("Parent Window Text : " ,"Parent Window Text : " + Left(ParentWindowText$, r))
; Get the class name of the parent window:
r = GetClassName_(hWndParent, @ParentClassName$, 100)
MessageRequester("Parent Window Class Name : ","Parent Window Class Name : " + Left(ParentClassName$, r))
Else
; Update fields when no parent:
MessageRequester("Window ID Number : ","Null")
MessageRequester("Parent Window Handle : ","Null")
MessageRequester("Parent Window Text : ","Nothing")
MessageRequester("Parent Window Class Name: ","Nothing")
EndIf
; ; Get window instance:
; hInstance = GetWindowLong_(hWndOver, #GWL_HINSTANCE)
; MessageRequester("Module : ",Str(hInstance))
; ; Get module file name:
; r = GetModuleFileName_(hInstance, @ModuleFileName$, 255)
; MessageRequester("Module : ","Module : " + Left(ModuleFileName$, r))
; ;MessageRequester("Module : ",Str(r))
EndIf