vbAccelerator - Contents of code file: frmWinSpy.frmVERSION 5.00
Begin VB.Form frmSimpleWinSpy
Caption = "Simple Windows Spy"
ClientHeight = 3840
ClientLeft = 4140
ClientTop = 2325
ClientWidth = 7080
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmWinSpy.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3840
ScaleWidth = 7080
Begin VB.TextBox txtParenthWnd
Height = 375
Left = 1080
TabIndex = 12
Top = 480
Width = 2415
End
Begin VB.TextBox txtExStyles
Height = 2295
Left = 4620
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 10
Top = 960
Width = 2415
End
Begin VB.TextBox txtStyles
Height = 2235
Left = 1080
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 8
Top = 960
Width = 2415
End
Begin VB.CheckBox chkEnabled
Caption = "&Enabled"
Height = 195
Left = 60
TabIndex = 7
Top = 3300
Value = 1 'Checked
Width = 3435
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 375
Left = 5760
TabIndex = 6
Top = 3360
Width = 1215
End
Begin VB.Frame fraInfo
Height = 75
Left = -480
TabIndex = 5
Top = 3120
Width = 7515
End
Begin VB.CheckBox chkAlwaysOnTop
Caption = "&Always On Top"
Height = 255
Left = 60
TabIndex = 4
Top = 3540
Width = 3435
End
Begin VB.TextBox txtClassName
Height = 375
Left = 4620
TabIndex = 2
Top = 60
Width = 2415
End
Begin VB.TextBox txthWnd
Height = 375
Left = 1080
TabIndex = 0
Top = 60
Width = 2415
End
Begin VB.Timer tmrhWnd
Enabled = 0 'False
Interval = 200
Left = 4560
Top = 3300
End
Begin VB.Label lblParent
Caption = "Parent hWnd"
Height = 195
Left = 60
TabIndex = 13
Top = 540
Width = 975
End
Begin VB.Label lblExStyles
Caption = "E&x Styles:"
Height = 195
Left = 3600
TabIndex = 11
Top = 1020
Width = 975
End
Begin VB.Label lblStyles
Caption = "&Styles:"
Height = 195
Left = 60
TabIndex = 9
Top = 1020
Width = 975
End
Begin VB.Label Label1
Caption = "&Class:"
Height = 195
Left = 3600
TabIndex = 3
Top = 120
Width = 975
End
Begin VB.Label lblhWnd
Caption = "&hWnd:"
Height = 195
Left = 60
TabIndex = 1
Top = 120
Width = 975
End
End
Attribute VB_Name = "frmSimpleWinSpy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal
hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal
hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long,
ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd
As Long) As Long
Private Const GW_OWNER = 4
Private Const GW_CHILD = 5
Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const GWL_USERDATA = (-21)
Private Const GWL_WNDPROC = -4
Private Const GWL_HWNDPARENT = (-8)
Private Const WS_OVERLAPPED = &H0&
Private Const WS_POPUP = &H80000000
Private Const WS_CHILD = &H40000000
Private Const WS_MINIMIZE = &H20000000
Private Const WS_VISIBLE = &H10000000
Private Const WS_DISABLED = &H8000000
Private Const WS_CLIPSIBLINGS = &H4000000
Private Const WS_CLIPCHILDREN = &H2000000
Private Const WS_MAXIMIZE = &H1000000
Private Const WS_CAPTION = &HC00000 ' /* WS_BORDER | WS_DLGFRAME
*/
Private Const WS_BORDER = &H800000
Private Const WS_DLGFRAME = &H400000
Private Const WS_VSCROLL = &H200000
Private Const WS_HSCROLL = &H100000
Private Const WS_SYSMENU = &H80000
Private Const WS_THICKFRAME = &H40000
Private Const WS_GROUP = &H20000
Private Const WS_TABSTOP = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
'' /*
' * Extended Window Styles
' */
Private Const WS_EX_DLGMODALFRAME = &H1&
Private Const WS_EX_NOPARENTNOTIFY = &H4&
Private Const WS_EX_TOPMOST = &H8&
Private Const WS_EX_ACCEPTFILES = &H10&
Private Const WS_EX_TRANSPARENT = &H20&
'#if(WINVER >= =&H0400)
Private Const WS_EX_MDICHILD = &H40&
Private Const WS_EX_TOOLWINDOW = &H80&
Private Const WS_EX_WINDOWEDGE = &H100&
Private Const WS_EX_CLIENTEDGE = &H200&
Private Const WS_EX_CONTEXTHELP = &H400&
Private Const WS_EX_RIGHT = &H1000&
Private Const WS_EX_LEFT = &H0&
Private Const WS_EX_RTLREADING = &H2000&
Private Const WS_EX_LTRREADING = &H0&
Private Const WS_EX_LEFTSCROLLBAR = &H4000&
Private Const WS_EX_RIGHTSCROLLBAR = &H0&
Private Const WS_EX_CONTROLPARENT = &H10000
Private Const WS_EX_STATICEDGE = &H20000
Private Const WS_EX_APPWINDOW = &H40000
'#endif ' /* WINVER >= =&H0400 */
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Sub chkAlwaysOnTop_Click()
If chkAlwaysOnTop.Value = Checked Then
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
Else
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End If
End Sub
Private Sub chkEnabled_Click()
tmrhWnd.Enabled = (chkEnabled.Value = Checked)
End Sub
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Form_Load()
tmrhWnd.Enabled = True
End Sub
Private Sub tmrhWnd_Timer()
Dim tP As POINTAPI
Dim lhWnd As Long
Dim iPos As Long
Dim sBuf As String
Dim lR As Long
GetCursorPos tP
lhWnd = WindowFromPoint(tP.x, tP.y)
txthWnd = Hex$(lhWnd)
txtClassName = ""
txtStyles = ""
txtParenthWnd = ""
If lhWnd <> 0 Then
txtParenthWnd = GetWindow(lhWnd, GW_OWNER)
sBuf = String$(255, 0)
lR = GetClassName(lhWnd, sBuf, 255)
If lR > 0 Then
iPos = InStr(sBuf, vbNullChar)
If (iPos > 0) Then
txtClassName = Left$(sBuf, iPos - 1)
Else
txtClassName = sBuf
End If
End If
lR = GetWindowLong(lhWnd, GWL_STYLE)
txtStyles = Hex$(lR) & ShowStyles(lR)
lR = GetWindowLong(lhWnd, GWL_EXSTYLE)
txtExStyles = Hex$(lR) & ShowExStyles(lR)
End If
End Sub
Private Function ShowStyles(ByVal lR As Long) As String
Dim sOut As String
Style sOut, lR, WS_POPUP, "WS_POPUP"
Style sOut, lR, WS_CHILD, "WS_CHILD"
Style sOut, lR, WS_MINIMIZE, "WS_MINIMIZE "
Style sOut, lR, WS_VISIBLE, "WS_VISIBLE"
Style sOut, lR, WS_DISABLED, "WS_DISABLED "
Style sOut, lR, WS_CLIPSIBLINGS, "WS_CLIPSIBLINGS"
Style sOut, lR, WS_CLIPCHILDREN, "WS_CLIPCHILDREN"
Style sOut, lR, WS_MAXIMIZE, "WS_MAXIMIZE"
Style sOut, lR, WS_CAPTION, "WS_CAPTION"
Style sOut, lR, WS_BORDER, "WS_BORDER"
Style sOut, lR, WS_DLGFRAME, "WS_DLGFRAME"
Style sOut, lR, WS_VSCROLL, "WS_VSCROLL"
Style sOut, lR, WS_HSCROLL, "WS_HSCROLL"
Style sOut, lR, WS_SYSMENU, "WS_SYSMENU"
Style sOut, lR, WS_THICKFRAME, "WS_THICKFRAME"
Style sOut, lR, WS_GROUP, "WS_GROUP"
Style sOut, lR, WS_TABSTOP, "WS_TABSTOP"
Style sOut, lR, WS_MINIMIZEBOX, "WS_MINIMIZEBOX"
Style sOut, lR, WS_MAXIMIZEBOX, "WS_MAXIMIZEBOX"
ShowStyles = sOut
End Function
Private Function ShowExStyles(ByVal lR As Long)
Dim sOut As String
Style sOut, lR, WS_EX_DLGMODALFRAME, "WS_EX_DLGMODALFRAME"
Style sOut, lR, WS_EX_NOPARENTNOTIFY, "WS_EX_NOPARENTNOTIFY"
Style sOut, lR, WS_EX_TOPMOST, "WS_EX_TOPMOST"
Style sOut, lR, WS_EX_ACCEPTFILES, "WS_EX_ACCEPTFILES"
Style sOut, lR, WS_EX_TRANSPARENT, "WS_EX_TRANSPARENT"
'#if(WINVER >= =&H0400)
Style sOut, lR, WS_EX_MDICHILD, "WS_EX_MDICHILD"
Style sOut, lR, WS_EX_TOOLWINDOW, "WS_EX_TOOLWINDOW"
Style sOut, lR, WS_EX_WINDOWEDGE, "WS_EX_WINDOWEDGE"
Style sOut, lR, WS_EX_CLIENTEDGE, "WS_EX_CLIENTEDGE"
Style sOut, lR, WS_EX_CONTEXTHELP, "WS_EX_CONTEXTHELP"
Style sOut, lR, WS_EX_RIGHT, "WS_EX_RIGHT"
Style sOut, lR, WS_EX_LEFT, "WS_EX_LEFT"
Style sOut, lR, WS_EX_RTLREADING, "WS_EX_RTLREADING"
Style sOut, lR, WS_EX_LTRREADING, "WS_EX_LTRREADING"
Style sOut, lR, WS_EX_LEFTSCROLLBAR, "WS_EX_LEFTSCROLLBAR"
Style sOut, lR, WS_EX_RIGHTSCROLLBAR, "WS_EX_RIGHTSCROLLBAR"
Style sOut, lR, WS_EX_CONTROLPARENT, "WS_EX_CONTROLPARENT"
Style sOut, lR, WS_EX_STATICEDGE, "WS_EX_STATICEDGE"
Style sOut, lR, WS_EX_APPWINDOW, "WS_EX_APPWINDOW"
ShowExStyles = sOut
End Function
Private Sub Style( _
ByRef s As String, _
ByVal lAll As Long, _
ByVal lBit As Long, _
ByVal sString As String _
)
If (lAll And lBit) = lBit Then
s = s & vbCrLf & sString
End If
End Sub
|
|