Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ActiveX, DLLs, VB, and VC++ - Oh, my!!

I'm in the very early stages of a project and need some guidance regarding VC++ and VB mixing. Essentially, I have a number of computation engines which I want to package as DLLs which will be called from VB. I would most like to write the DLLs in VC++. They will be used to due intensive compuations but won't be responsible for any graphical output.

My question(s):

What are the requirements to develop components in VC++ such that VB can call them?

What about classes? Can I have class objects passed to and from VB into/out of the DLLs? (Class objects would most appropriately contain my data.)

What variable types are compatible between the two languages employed in this manner?

Are there any really good books out there which show you how to do these things? Most of the books I've seen deal with strictly visual components rather than computation engines such as these.

Any help is appreciated.


Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    VB was created to work with COM objects and ActiveX controls. ActiveX is built on top of COM. In VC++ you create:
    1. An ActiveX if you need GUI in some place.
    2. COM object if you need some 'silent' object: database transactions, calculation engine, etc.

    When you done you use VB script to create an instance of the object and call its methods and work with its properties:

    strPath As String;
    MyEngine As CalcEngine; 'That is your COM made with VC++


    CalcEngine.Property1 = 17
    CalcEngine.Property2 = 4
    n = CalcEngine.Modulo

    ------------------------------------------
    something like that.

    Next step for you will be creating a simple COM (there is a Wizard in VC++, so you do not need to type huge pile of code) and hooking it up to VB. The best source is MSDN for this task - look up the articles - in usual help you can't find much... search for something like: "COM objects in VB" or something close. If you did not find a lot at this point search for articles about COM, but then you will have to scan a HUGE pile of material, so it will take more time for you to learn what you need...

    Good luck!
    Cheers!


  • KirkDKirkD Posts: 44Member
    Guru,

    Thank you!! That clarifies a lot. Hmmm...it appears I have some reading to do, eh?




    : VB was created to work with COM objects and ActiveX controls. ActiveX is built on top of COM. In VC++ you create:
    : 1. An ActiveX if you need GUI in some place.
    : 2. COM object if you need some 'silent' object: database transactions, calculation engine, etc.
    :
    : When you done you use VB script to create an instance of the object and call its methods and work with its properties:
    :
    : strPath As String;
    : MyEngine As CalcEngine; 'That is your COM made with VC++
    :
    :
    : CalcEngine.Property1 = 17
    : CalcEngine.Property2 = 4
    : n = CalcEngine.Modulo
    :
    : ------------------------------------------
    : something like that.
    :
    : Next step for you will be creating a simple COM (there is a Wizard in VC++, so you do not need to type huge pile of code) and hooking it up to VB. The best source is MSDN for this task - look up the articles - in usual help you can't find much... search for something like: "COM objects in VB" or something close. If you did not find a lot at this point search for articles about COM, but then you will have to scan a HUGE pile of material, so it will take more time for you to learn what you need...
    :
    : Good luck!
    : Cheers!
    :
    :
    :

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    I was doing exactly that couple of years back - let me dig up my docs which explains how to make it work (if I can) and I'll send something to you...
Sign In or Register to comment.