Advertisement
5_2007-2008 Windows API Call/ Explanation #174294

Text Finder

This program uses API calls to find the text of almost any Window, including ones blocked with password characters. Just hover the mouse cursor over the window. Also shows Window handle. Makes use of SetWindowPos for "Always On Top" API call. Note: This Visual Basic version makes use of the GetWindowText call, which does not always return Window text, while the SendMessage call with WM_GETTEXT seems to work more often. Contact me to obtain the VC++ version which uses SendMessage instead.

AI

Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kaynak Kod
original-source
Private Sub Form_Load() 'Set Window to "Always On Top"
  Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub tmrRefresh_Timer()
  Dim cursorPos As POINTAPI, textLength As Integer
  Dim hWnd As Long, winText As String
  
  Static prevHWnd As Long 'Store handle of previous Window
  
  Call GetCursorPos(cursorPos) 'Get current mouse position
  hWnd = WindowFromPoint(cursorPos.x, cursorPos.y) 'Get handle to Window mouse is over
  
  If prevHWnd <> hWnd Then 'If the Window mouse is the same as the previous Window that the mouse was over, don't refresh the information
    txtHWnd.Text = hWnd 'Show Window handle
    textLength = GetWindowTextLength(hWnd) + 1 'Get length of Window text
    winText = Space(textLength) 'Setup buffer to copy Window text
    Call GetWindowText(hWnd, winText, textLength) 'Get the actual text
    txtWinText.Text = winText
    prevHWnd = hWnd
  End If
End Sub

Upload
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı