WindowsSpy




'Windows API/Global Declarations for : Window SPY

Public Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Public Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetModuleFileName Lib "kernel32" _
Alias "GetModuleFileNameA" (ByVal hModule As Long, _
ByVal lpFileName As String, ByVal nSize As Long) As Long
Public Declare Function WindowFromPointXY Lib "user32" _
Alias "WindowFromPoint" (ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Public Declare Function GetClassName& Lib "user32" _
Alias "GetClassNameA" (ByVal hwnd As Long, _
ByVal lpClassName As String, ByVal nMaxCount As Long)
Public Declare Function GetWindowWord Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Integer
Public Declare Function GetParent Lib "user32" _
(ByVal hwnd As Long) As Long
'**** Put this in a module ****

Function WindowSPY(WinHdl As TextBox, WinClass As TextBox, _
WinTxt As TextBox, WinStyle As TextBox, WinIDNum _
As TextBox, WinPHandle As TextBox, WinPText _
As TextBox, WinPClass As TextBox, WinModule As TextBox)
'Call This In A Timer

Dim pt32 As POINTAPI, ptx As Long, pty As Long, sWindowText As String * 100
Dim sClassName As String * 100, hWndOver As Long, hWndParent As Long
Dim sParentClassName As String * 100, wID As Long, lWindowStyle As Long
Dim hInstance As Long, sParentWindowText As String * 100
Dim sModuleFileName As String * 100, r As Long
Static hWndLast As Long
Call GetCursorPos(pt32)
ptx = pt32.X
pty = pt32.Y
hWndOver = WindowFromPointXY(ptx, pty)
If hWndOver <> hWndLast Then
hWndLast = hWndOver
WinHdl.Text = "Window Handle: " & hWndOver
r = GetWindowText(hWndOver, sWindowText, 100)
WinTxt.Text = "Window Text: " & Left(sWindowText, r)
r = GetClassName(hWndOver, sClassName, 100)
WinClass.Text = "Window Class Name: " & Left(sClassName, r)
lWindowStyle = GetWindowLong(hWndOver, GWL_STYLE)
WinStyle.Text = "Window Style: " & lWindowStyle
hWndParent = GetParent(hWndOver)
If hWndParent <> 0 Then
wID = GetWindowWord(hWndOver, GWW_ID)
WinIDNum.Text = "Window ID Number: " & wID
WinPHandle.Text = "Parent Window Handle: " & hWndParent
r = GetWindowText(hWndParent, sParentWindowText, 100)
WinPText.Text = "Parent Window Text: " & Left(sParentWindowText, r)
r = GetClassName(hWndParent, sParentClassName, 100)
WinPClass.Text = "Parent Window Class Name: " & Left(sParentClassName, r)
Else
WinIDNum.Text = "Window ID Number: N/A"
WinPHandle.Text = "Parent Window Handle: N/A"
WinPText.Text = "Parent Window Text : N/A"
WinPClass.Text = "Parent Window Class Name: N/A"
End If
hInstance = GetWindowWord(hWndOver, GWW_HINSTANCE)
r = GetModuleFileName(hInstance, sModuleFileName, 100)
WinModule.Text = "Module: " & Left(sModuleFileName, r)
End If
End Function

****** End OF MODULE ******
'Put this is notepad and rename is winspy.frm

VERSION 5.00
Begin VB.Form Form1
BackColor=&H00000000&
Caption ="Window SPY"
ClientHeight=3480
ClientLeft =2280
ClientTop=1590
ClientWidth =4440
LinkTopic="Form1"
ScaleHeight =3480
ScaleWidth =4440
Begin VB.Timer Timer1
Interval=10
Left=1080
Top =1560
End
Begin VB.TextBox Text9
Appearance =0 'Flat
BackColor=&H00000000&
BeginProperty Font
Name="Arial"
Size=8.25
Charset =0
Weight =700
Underline=0'False
Italic =0'False
Strikethrough=0'False
EndProperty
ForeColor=&H00FFFFFF&
Height =285
Left=120
TabIndex=8
Text="Text9"
Top =3000
Width=4215
End
Begin VB.TextBox Text8
Appearance =0 'Flat
BackColor=&H00000000&
BeginProperty Font
Name="Arial"
Size=8.25
Charset =0
Weight =700
Underline=0'False
Italic =0'False
Strikethrough=0'False
EndProperty
ForeColor=&H00FFFFFF&
Height =285
Left=120
TabIndex=7
Text="Text8"
Top =2640
Width=4215
End
Begin VB.TextBox Text7
Appearance =0 'Flat
BackColor=&H00000000&
BeginProperty Font
Name="Arial"
Size=8.25
Charset =0
Weight =700
Underline=0'False
Italic =0'False
Strikethrough=0'False
EndProperty
ForeColor=&H00FFFFFF&
Height =285
Left=120
TabIndex=6
Text="Text7"
Top =2280
Width=4215
End
Begin VB.TextBox Text6
Appearance =0 'Flat
BackColor=&H00000000&
BeginProperty Font
Name="Arial"
Size=8.25
Charset =0
Weight =700
Underline=0'False
Italic =0'False
Strikethrough=0'False
EndProperty
ForeColor=&H00FFFFFF&
Height =285
Left=120
TabIndex=5
Text="Text6"
Top =1920
Width=4215
End
Begin VB.TextBox Text5
Appearance =0 'Flat
BackColor=&H00000000&
BeginProperty Font
Name="Arial"
Size=8.25
Charset =0
Weight =700
Underline=0'False











( windowsspy.html )- by Paolo Puglisi - Modifica del 17/12/2023