Skip to main content

AccessTr.neT


HWND değeri bilinen metin kutusunun içeriğini access içerisine almak

HWND değeri bilinen metin kutusunun içeriğini access içerisine almak

Çözüldü #3
ararken buldum arkadaşlar
Kod:
Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd _
    As Long, ByVal wCmd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias _
    "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName _
    As String, ByVal nMaxCount As Long) As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE

' Return information about this window.
Public Function WindowInfo(window_hwnd As Long) As String
Dim txt As String
Dim buf As String
Dim buflen As Long
Dim child_hwnd As Long
Dim children As Collection
Dim i As Integer

    ' Get the class name.
    buflen = 256
    buf = Space$(buflen - 1)
    buflen = GetClassName(window_hwnd, buf, buflen)
    buf = Left$(buf, buflen)
    txt = "Class: " & buf & vbCrLf

    ' hWnd.
    txt = txt & "    hWnd: " & _
        Format$(window_hwnd) & vbCrLf
        
    ' Associated text.
    txt = txt & "    Text: [" & _
        WindowText(window_hwnd) & "]" & vbCrLf

    ' Make a list of the child windows.
    Set children = New Collection
    child_hwnd = GetWindow(window_hwnd, GW_CHILD)
    Do While child_hwnd <> 0
        children.Add child_hwnd
        child_hwnd = GetWindow(child_hwnd, GW_HWNDNEXT)
    Loop
    
    ' Get information on the child windows.
    For i = 1 To children.Count
        txt = txt & WindowInfo(children(i))
    Next i

    WindowInfo = txt
End Function

' Return the text associated with the window.
Public Function WindowText(window_hwnd As Long) As String
Dim txtlen As Long
Dim txt As String

    WindowText = ""
    If window_hwnd = 0 Then Exit Function
    
    txtlen = SendMessage(window_hwnd, WM_GETTEXTLENGTH, 0, _
        0)
    If txtlen = 0 Then Exit Function
    
    txtlen = txtlen + 1
    txt = Space$(txtlen)
    txtlen = SendMessage(window_hwnd, WM_GETTEXT, txtlen, _
        ByVal txt)
    WindowText = Left$(txt, txtlen)
End Function

@benbendedeilem
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Cvp: HWND değeri bilinen metin kutusunun içeriğini access içerisine almak - Yazar: accessman - 07/06/2012, 15:55
Task