Thread: Using C DLLs in VB

  1. #1
    Unregistered
    Guest

    Question Using C DLLs in VB

    I have been trying, unsuccessfully to work with a c program from visual basic, the dll's that I need to use were written in C. I have been unable to register these dll's, is there a way to use them with Visual Basic?

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    32
    damn, i've seen an article on this on the web but cant remember where it is...

    make a search at www.codeguru.com it's probably around there. also, in the same site, check the discussion boards (both the vb and the vcc) the vcc board has a dll section. anyway somewhere in these 2 boards u search and u'll find the answer for sure.

    null

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    32

    Thumbs up

    hi again. here are some links for you, seems what you looking for...

    HOWTO: Make C DLL More Accessible to VB with a Type Library
    http://support.microsoft.com/support.../Q189/1/33.ASP

    Creating C++ DLLs to help VB
    http://www.vbsquare.com/misc/cdlls/

    Visual Basic Explorer
    http://www.vbexplorer.com/

    Creating a DLL for VB in VC++
    http://www.daly.co.uk/iconic/programs/code.html

    Programming Custom Hardware in Visual Basic
    http://www.boondog.com/..%5Ctutorial...5Cdlltutor.htm

    Extending VB with C++
    http://pub13.ezboard.com/fvisualbasicexplorerfrm36

    hope it helps...

    null

  4. #4
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    you do in visual basic

    Private Declare Function MyFunction(ByVal a as Integer, ByVal b as Integer, ByRef c as Integer) as Integer

    if you declared the function as:

    int MyFunction(int a, int b, int* c);

    or.

    Private Declare Sub MyVoidFunction(ByVal a as Integer, b as String)

    if you did

    void MyVoidFunction(int a, LPCSTR b);

    voids do Sub's
    anything else does functions, and at the end, you put the return type

    void Sub
    int Integer
    float I don't know, but I think it's Single
    double Double
    char* or LPCSTR String
    DWORD Long
    char Byte

    but remember, most VB types are unsigned, so do something about it

    adn, if you use a pointer, in VB use ByRef or leave blank, otherwise, use ByVal

    Good Luck

    Oskilian

  5. #5

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. standart dlls
    By keeper in forum C++ Programming
    Replies: 3
    Last Post: 07-05-2006, 07:32 PM
  2. Passing an Array of Strings from VB to a C DLL
    By mr_nice! in forum Windows Programming
    Replies: 9
    Last Post: 03-08-2005, 06:16 AM
  3. VB DLLs with C++
    By confuted in forum Tech Board
    Replies: 1
    Last Post: 10-31-2003, 09:36 AM
  4. Making C++ DLLS for VB
    By MethSnax in forum Windows Programming
    Replies: 0
    Last Post: 07-20-2003, 08:47 AM
  5. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM