G
Guest
Hi, im trying to get the caption text from the active window but i cant get it working in vb.net. Can somebody please help me. Im new to using API
Public Class Form
Inherits System.Windows.Forms.For
#Region " Windows Form Designer generated code
' Return Caption.ToString(
Public Declare Function GetActiveWindow Lib "user32" () As System.IntPt
Public Declare Auto Function GetWindowText Lib "user32"
(ByVal hWnd As System.IntPtr,
ByVal lpString As System.Text.StringBuilder,
ByVal cch As Integer) As Intege
' Create a buffer of 256 character
Dim Caption As New System.Text.StringBuilder(256
Dim hWnd As IntPtr = GetActiveWindow(
Dim t As Strin
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim t As Strin
t = GetWindowText(hWnd, Caption, Caption.Capacity) 'put the caption text in strin
End Su
End Class
Public Class Form
Inherits System.Windows.Forms.For
#Region " Windows Form Designer generated code
' Return Caption.ToString(
Public Declare Function GetActiveWindow Lib "user32" () As System.IntPt
Public Declare Auto Function GetWindowText Lib "user32"
(ByVal hWnd As System.IntPtr,
ByVal lpString As System.Text.StringBuilder,
ByVal cch As Integer) As Intege
' Create a buffer of 256 character
Dim Caption As New System.Text.StringBuilder(256
Dim hWnd As IntPtr = GetActiveWindow(
Dim t As Strin
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim t As Strin
t = GetWindowText(hWnd, Caption, Caption.Capacity) 'put the caption text in strin
End Su
End Class