Results 1 to 2 of 2

Thread: Forcing Error???

  1. #1
    DerFarm
    Guest

    Forcing Error???

    The program is blowing up at this point:

    Code:
    Private Sub DoCapture_Click()
    Dim str_temp0 As String, i As Integer
    Dim aMsg As Msg
        Open "C:\downloads\xxx.xxx" For Output As #1
        Do While i < 1000
           dummy = GetMessage(aMsg, TargetWindowHandle, 0, 0)
           str_temp0 = Str$(aMsg.hWnd) & "|"
           str_temp0 = str_temp0 & Str$(aMsg.lParam) & "|"
           str_temp0 = str_temp0 & Str$(aMsg.message) & "|"
           str_temp0 = str_temp0 & Str$(aMsg.pt) & "|"
           str_temp0 = str_temp0 & Str$(aMsg.time) & "|"
           str_temp0 = str_temp0 & Str$(aMsg.wParam) & "|"
           Print #1, str_temp0
           i = i + 1
        Loop
        Close #1
    
    Xit_DoCapture_Click:
    End Sub
    Code:
    Type Msg
        hWnd As Long
        message As Long
        wParam As Long
        lParam As Long
        time As Long
        pt As POINTAPI
    End Type
    the error message is:

    Compile Error:

    Only user defined-types defined in public object modules
    can be coerced to or from a variant or passed to late bound
    functions.
    DoCapture is a command button.

    TargetWindowHandle is global. I get the same message when it
    is set and when it is not.

    Type POINTAPI has been properly typed.

    Any ideas on what kind of stupid thing I've done?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    On what specific line does it point when it blows up?

    Also, post the entire routine. You have an variable called "dummy" that is not dimensioned (you are using Option Explicit I trust), and you have an error trapping routine with no exit sub before it, or no on error goto to get there.

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