Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Importing classes in VC from VB DLL

The_TrooperThe_Trooper Member Posts: 2
Has anyone had expirience with importing classes from VB to VC (using DLLs)? I searched the Net and in MSDN, but the only things I found were importing DLLs using LIB files, or importing funtions only (GetProcAddress).

Is there any way to directly make an instance of VB class in VC?

Comments

  • tsagldtsagld Member Posts: 621
    Not possible. Dll's in VB are not real dll's, as they have a completely different format.

    With .NET though, you can mix any language that supports .NET you like.

    : Has anyone had expirience with importing classes from VB to VC (using DLLs)? I searched the Net and in MSDN, but the only things I found were importing DLLs using LIB files, or importing funtions only (GetProcAddress).
    :
    : Is there any way to directly make an instance of VB class in VC?
    :


    Greets,
    Eric Goldstein
    www.gvh-maatwerk.nl

  • ColdShineColdShine Member Posts: 597
    : Is there any way to directly make an instance of VB class in VC?

    Of course there is, but only if the "class" you are talking about was written into a ClassModule.
    If it is, then you can use CreateObject to create an instance of the object. Every VB class is registered when the containing server DLL is self-registered. I seem to remember you can use the [blue]#import[/blue] statement in VC to direclty import the DLL's embedded type library as if it was a standard header file, so you just declare a pointer to the interface of the object you want, like you would to for any standard COM object.
    If it is not, then there is nothing you can do. VB embedded classes (Form, ListBox, AppObject, and so on) do not have a real COM interface, so only the VB runtime library knows how to create an instance of those classes.
    ________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]

  • ColdShineColdShine Member Posts: 597
    : Not possible. Dll's in VB are not real dll's, as they have a completely different format.

    Where did you ever read this?

    Upon the time VB has allowed users to create classes (since version 4.0, both 16- & 32-bit), they have always been COM-compliant classes, so useable by any COM-compatible programming language (Delphi, VC++ and VB itself). From version 5.0, VB also allows creating custom controls compliant with the ActiveX liteweigth standard and backwards compatible with the old OLE Automation standards.
    ________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]

  • tsagldtsagld Member Posts: 621
    : : Not possible. Dll's in VB are not real dll's, as they have a completely different format.
    :
    : Where did you ever read this?
    :
    : Upon the time VB has allowed users to create classes (since version 4.0, both 16- & 32-bit), they have always been COM-compliant classes, so useable by any COM-compatible programming language (Delphi, VC++ and VB itself). From version 5.0, VB also allows creating custom controls compliant with the ActiveX liteweigth standard and backwards compatible with the old OLE Automation standards.

    Ok, you're right. I was thinking about exporting functions from a VB-dll, which is not possible. That has nothing to do with COM-classes. Sorry.

    : ________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
    :
    :


    Greets,
    Eric Goldstein
    www.gvh-maatwerk.nl

  • The_TrooperThe_Trooper Member Posts: 2
    This helped me figure out a way. Thanks!
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _________ \ http://forcoder.org \ free ebooks and video tutorials about | Java, Delphi, PHP, PL/SQL, Assembly, Ruby, C, JavaScript, Go, Objective-C, MATLAB, Visual Basic, R, C++, Scratch, Visual Basic .NET, Perl, Python, Swift, C# FoxPro, Dart, Crystal, Logo, F#, Hack, Lisp, LabVIEW, Bash, Transact-SQL, Rust, Clojure, Kotlin, SAS, ML, Scala, D, VBScript, ABAP, Lua, Alice, Ada, Scheme, Erlang, Awk, Prolog, Fortran, COBOL, Julia, Apex | ______

Sign In or Register to comment.