Results 1 to 3 of 3

Thread: how can i call a c++ dll i made in vc++ in visual basic

  1. #1
    Guest

    Post

    i've made a c++ dll, and im trying to make it work in visual basic, in c++ the dll has a char [255] and int data types. please help..

    ------------------
    DeViLdiGGeR


  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    You'll need to declare a Function like this one which is used with a dll named RWTGetData, but modified for your dll location and fields passed by the dll.

    Public Declare Function RWTGetData Lib "c:\rqt\dbacc.dll" (ByVal sData As String, ByRef nErrCode As Long, ByVal sErrText As String) As Long


    I don't think the Ints passed by the dll will be a problem, but the chars will probably need to be handled as follows:

    Code:
    Dim sData as String
    Dim lRC As Long
    Dim sData as String
    Dim sErrText as String
    
    sData = String(255, 0)
    sData = Space(MAXLEN)
    lRC = RWTGetData(sData, lError, sErrText)


    ------------------
    Marty

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    AFAIK there's an API command for running dll's...

    You can also call dll's using 'RunDll.exe' found in your windows dir. (But I don't know how to send arguments to the called function.. if anyone could help me, will be great.)



    ------------------
    Fox
    gigotz@gmx.net
    http://gigotz.tsx.org
    ...
    Every program can be reduced to one instruction which doesn't work.


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