Results 1 to 3 of 3

Thread: GetMessage...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    GetMessage...

    Hiyas,

    I've tried to write code to intercept messages from Notepad. However, when I have Notepad open and I call the GetMessage routine, VB totally freezes. I can't break it, so I have to Crtl-Alt-Del it. Any idea what's wrong and how to fix it? Here's the code.

    Code:
    Option Explicit
    
    Dim Message As Msg
    Dim nphwnd As Long
    
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
    Private Type POINTAPI
        x As Long
        y As Long
    End Type
    Private Type Msg
        hWnd As Long
        Message As Long
        wParam As Long
        lParam As Long
        time As Long
        pt As POINTAPI
    End Type
    
    Private Sub Form_Load()
        
        nphwnd = FindWindow(vbNullString, "Untitled - Notepad")
        GetMessage Message, nphwnd, 0, 0
        
    End Sub
    Thanks,

    -Git

  2. #2
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    git, i will dig out the code for this later today, if i have time.



    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Cool, thank you!

    -Git

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