Results 1 to 3 of 3

Thread: Capturing the Caption of an Application

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Singapore
    Posts
    6

    Capturing the Caption of an Application

    How could I monitor the windows message and identify which pop up dialogue box belongs to which applicaion window.

    I am building a test application to monitor what was activated and capture the events.

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    To get the caption of any window, you can use "GetWindowText" api call. To find popup windows, you can use "FindWindow" api call.

  3. #3
    Megatron
    Guest
    Here's an example of using GetWindowText (replace hwnd with the handle of the window)
    VB Code:
    1. Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4.    
    5.     Dim sTitle As String
    6.     Dim iLength As Integer
    7.    
    8.     sTitle = Space$(256)
    9.     iLength = GetWindowText(hwnd, sTitle, 256)
    10.     sTitle = Left$(sTitle, InStr(1, sTitle, vbNullChar) - 1)
    11.    
    12.     MsgBox sTitle
    13.    
    14. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width