visual basic Window SPY


SUBMITTED BY: vishaldagar

DATE: June 22, 2017, 11:22 a.m.

FORMAT: Text only

SIZE: 2.3 kB

HITS: 959

  1. 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)
  2. 'Call This In A Timer
  3. Dim pt32 As POINTAPI, ptx As Long, pty As Long, sWindowText As String * 100
  4. Dim sClassName As String * 100, hWndOver As Long, hWndParent As Long
  5. Dim sParentClassName As String * 100, wID As Long, lWindowStyle As Long
  6. Dim hInstance As Long, sParentWindowText As String * 100
  7. Dim sModuleFileName As String * 100, r As Long
  8. Static hWndLast As Long
  9. Call GetCursorPos(pt32)
  10. ptx = pt32.X
  11. pty = pt32.Y
  12. hWndOver = WindowFromPointXY(ptx, pty)
  13. If hWndOver <> hWndLast Then
  14. hWndLast = hWndOver
  15. WinHdl.Text = "Window Handle: " & hWndOver
  16. r = GetWindowText(hWndOver, sWindowText, 100)
  17. WinTxt.Text = "Window Text: " & Left(sWindowText, r)
  18. r = GetClassName(hWndOver, sClassName, 100)
  19. WinClass.Text = "Window Class Name: " & Left(sClassName, r)
  20. lWindowStyle = GetWindowLong(hWndOver, GWL_STYLE)
  21. WinStyle.Text = "Window Style: " & lWindowStyle
  22. hWndParent = GetParent(hWndOver)
  23. If hWndParent <> 0 Then
  24. wID = GetWindowWord(hWndOver, GWW_ID)
  25. WinIDNum.Text = "Window ID Number: " & wID
  26. WinPHandle.Text = "Parent Window Handle: " & hWndParent
  27. r = GetWindowText(hWndParent, sParentWindowText, 100)
  28. WinPText.Text = "Parent Window Text: " & Left(sParentWindowText, r)
  29. r = GetClassName(hWndParent, sParentClassName, 100)
  30. WinPClass.Text = "Parent Window Class Name: " & Left(sParentClassName, r)
  31. Else
  32. WinIDNum.Text = "Window ID Number: N/A"
  33. WinPHandle.Text = "Parent Window Handle: N/A"
  34. WinPText.Text = "Parent Window Text : N/A"
  35. WinPClass.Text = "Parent Window Class Name: N/A"
  36. End If
  37. hInstance = GetWindowWord(hWndOver, GWW_HINSTANCE)
  38. r = GetModuleFileName(hInstance, sModuleFileName, 100)
  39. WinModule.Text = "Module: " & Left(sModuleFileName, r)
  40. End If
  41. End Function
  42. ****** END OF MODULE ******
  43. 'Put this is notepad and rename is winspy.frm
  44. VERSION 5.00
  45. Begin VB.Form Form1
  46. BackColor=&H00000000&
  47. Caption ="Window SPY"
  48. ClientHeight=3480
  49. ClientLeft =2280
  50. ClientTop=1590
  51. ClientWidth =4440
  52. LinkTopic="Form1"
  53. ScaleHeight =3480
  54. ScaleWidth =4440
  55. Begin VB.Timer Timer1
  56. Interval=10
  57. Left=1080
  58. Top =1560
  59. End

comments powered by Disqus