سلام
من با استفاده از تابع getwindowtext نمیتونم محتویات خیلی از عناثر را بگیرم مثل محتویات نوت پد یا نوشته های درون کمبو باکس ها!
یه گشتی هم زدم تو نت فهمیدم باید با send messege کار کنم ولی بازم نتونستم ! میشه کمک کنین
form1 code
module code
من با استفاده از تابع getwindowtext نمیتونم محتویات خیلی از عناثر را بگیرم مثل محتویات نوت پد یا نوشته های درون کمبو باکس ها!
یه گشتی هم زدم تو نت فهمیدم باید با send messege کار کنم ولی بازم نتونستم ! میشه کمک کنین
form1 code
کد:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Dim str As String * 50
List1.Clear
Dim fwh As Long
fwh = GetForegroundWindow
GetWindowText fwh, str, 50
Text1.Text = str
EnumChildWindows fwh, AddressOf EnumChildProc, ByVal 0&
End Sub
module code
کد:
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Form1.List1.AddItem GetText(hwnd) & " " & hwnd
EnumChildProc = True
End Function
Public Function GetText(hwnd As Long)
Dim buffer As String
Dim lenCaption As Long
lenCaption = GetWindowTextLength(hwnd)
buffer = Space$(lenCaption + 1)
GetWindowText hwnd, buffer, Len(buffer)
GetText = Left$(buffer, Len(buffer) - 1)
End Function