Results 1 to 4 of 4

Thread: Problem with external dll

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    5

    Problem with external dll

    Hey,
    recently, I've been trying to use Moo (http://www.influenced.net/moodll.php) from within a VB.Net prog, but I'm having problems with the function declaration.

    The functions (C++) look like
    Code:
    int __stdcall uptime(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL print, BOOL nopause)
    (standard declaration for mIRC's $dll calls - the function doesn't use anything but the data string/char-array, which it does a strcpy() to)

    I have my function declaration like
    Code:
    Public Declare Auto Function uptime Lib "c:\moowrap\moo.dll" (ByRef mWnd, ByRef aWnd, ByRef data, ByVal parms, ByVal print, ByVal nopause) As Integer
    my test-code looks like:
    Code:
            Dim mWnd As System.IntPtr
            Dim aWnd As System.IntPtr
    
            Dim data As String
            Dim parms As String
    
            Dim print As Boolean
            Dim nopause As Boolean
    
            mWnd = Me.Handle
            aWnd = Me.Handle
    
            data = ""
            parms = ""
    
            print = True
            nopause = True
    
            uptime(mWnd, aWnd, data, parms, print, nopause)
            MessageBox.Show(data)
    but i get a error message:
    An unhandled exception of type 'System.Runtime.InteropServices.InvalidOleVariantTypeException' occurred in WindowsApplication1.exe

    Additional information: Specified OLE variant is invalid.

    any thoughts?

  2. #2

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    5
    oh btw, forgot to mention that the problem seems to be the data variable..

  3. #3
    Junior Member Guile.NET's Avatar
    Join Date
    Mar 2003
    Location
    www.voodoochat.com
    Posts
    31
    Just a guess:

    VB Code:
    1. Dim mWnd As Integer
    2.         Dim aWnd As Integer
    3.  
    4.         Dim data As String
    5.         Dim parms As String
    6.  
    7.         Dim print As Boolean
    8.         Dim nopause As Boolean
    9.  
    10.         mWnd = Me.Handle.ToInt32
    11.         aWnd = Me.Handle.ToInt32
    12.  
    13.         data = ""
    14.         parms = ""
    15.  
    16.         print = True
    17.         nopause = True
    18.  
    19.         uptime(mWnd, aWnd, data, parms, print, nopause)
    20.         MessageBox.Show(data)
    The arrow shot by the archer may, or may not, kill a single person. However, stratagems devised by a wise man, can kill even babes in the womb.

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    5
    Nope, didn't help. :/

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