I need some help with this one. i have a few code samples I have found on the internet, however, when I attempt to use them I get errors, and nothing really works. What I'm trying to do is get the text of a message box, and the contents of the message. Can anyone please help with sample code? I would appreciate it.

./amvx86

Also is this your app, or are you reading from someone elses app?

Sorry about the delay. No this is my application that I'm writing. I'm sampling code from other people because I am a little lost in .net 4.0 in vb 2010. I will post the information when I can get to the computer I am working on the code. Hang tight, and I appreciate the help.

I sample code from old projects of mine, and that was a delay like no other. The code I'm dealing with is as follows:

    `Dim WINDOW& = FindWindow("#32770", "2323234124312")`

//THE REASON WHY YOU SEE THE 232323232... IS BECAUSE IT IS SAYING THAT THE WINDOWS IS OPEN

what I'm really looking for however, is a specific window that is a message box, but it keeps saying the window is open when I know for fact it is not. I tried to use another piece of code however, that has failed and left me frustrated.

I have also tried to access this 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

with the old vb 6 version:

     Public Function GetText(ByVal hwnd As Long) As String

    ' This function will return the text from a hWnd.  The following
    ' example will return the text from the chatroom.

    ' RICHCNTL& = FindWindowEx(FindChatWnd(), 0&, "RICHCNTL", vbNullString)
    ' ChatText$ = GetText(RICHCNTL&)

    Dim TextLen As Long, hWndTxt As String
    TextLen& = SendMessage(hwnd&, WM_GETTEXTLENGTH, 0&, vbNullString)
    hWndTxt$ = (TextLen&)
    Call SendMessageByString(hwnd&, WM_GETTEXT, TextLen& + 1&, hWndTxt$)
    GetText$ = hWndTxt$
End Function

Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGTH = &HE
Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Object) As Long

Private Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetParent Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

and when using this it tells me that it unbalanced the stack? Any suggestions?

./amvx86

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.