Calling VB DLLs from VC/C++ 
Author Message
 Calling VB DLLs from VC/C++

Hello all,
I am looking for a sample code (or directions to related articles) on how
can I call a VB DLL
from a C/C++ program. If you have also any comments on how this VB DLL can
be called from other MS languages like fortran don't hesitate to send them
too.
Thanks in advance

Iakovos Karakas




Sun, 09 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

Quote:

> Hello all,
> I am looking for a sample code (or directions to related articles) on how
> can I call a VB DLL
> from a C/C++ program. If you have also any comments on how this VB DLL can
> be called from other MS languages like FORTRAN don't hesitate to send them
> too.
> Thanks in advance

> Iakovos Karakas



What do you mean a "VB DLL" VBRUN300.DLL?

Carlos
http://www.simple-sw.com



Mon, 10 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

Does he mean an ActiveX DLL??

l.ntua.gr>...

Quote:
>Hello all,
>I am looking for a sample code (or directions to related articles) on how
>can I call a VB DLL
>from a C/C++ program. If you have also any comments on how this VB DLL
can
>be called from other MS languages like FORTRAN don't hesitate to send
them
>too.
>Thanks in advance

>Iakovos Karakas





Tue, 11 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

Yes I believe he does.



Quote:
> Does he mean an ActiveX DLL??
>  Iakovos Karakas wrote in article


Quote:
> l.ntua.gr>...
> >Hello all,
> >I am looking for a sample code (or directions to related articles) on
how
> >can I call a VB DLL
> >from a C/C++ program.

[...]


Tue, 11 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++



Quote:
> Yes I believe he does.

Well, you just write a VB ActiveX dll, and use the new VC 5 #import to
access it:

#import "C:\\sources\\w6servicescheduler\\output\\W6RPC.dll"
rename_namespace("GOLDBERG")

#include <stdio.h>
#include <tchar.h>
#include <iostream.h>

struct StartOle {
    StartOle() { CoInitialize(NULL); }
    ~StartOle() { CoUninitialize(); }

Quote:
} _inst_StartOle;

long callvb(char *strMsg)
{
        long lResult;

        using namespace GOLDBERG;

        try
        {
                _W6MessagePtr pXL("W6Rpc.W6Message"); // that's VB ActiveX DLL object
                _bstr_t bs(strMsg);
                lResult = pXL->SendMessage(bs);
                cout << lResult << endl;
    } catch (_com_error &e)
        {
        dump_com_error(e);
                return -1;
    }

        return lResult;

Quote:
}



Fri, 14 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

First read...
 VB4DLL.TXT
 VB5DLL.TXT
Then look for all information about...
 OLEAUTO.H
There's a neat sample somewhere (on MSDN, I think), that makes a simple
HELLO app call to a OLE server.  It can be easily modified to call any VB
OLE server-app/dll.  And it's in C!!!
Or look in the VC help:
------------------------------------------
Visual Basic provides full support for OLE Automation. The following table
lists how Visual Basic statements translate into OLE APIs.
Visual Basic Statement  OLE APIs
CreateObject    CLSIDFromProgID
                CoCreateInstance
                QueryInterface to get IDispatch interface.
GetObject       CLSIDFromProgID
                CoCreateInstance
                QueryInterface for IPersistFile interface.
                Load on IPersistFile interface.
                QueryInterface to get IDispatch interface.
GetObject       CreateBindCtx creates the bind context for the subsequent
functions.
                MkParseDisplayName returns a moniker handle for BindMoniker.
                BindMoniker returns a pointer to the IDispatch interface.
                Release on moniker handle.
                Release on context.
GetObject       CLSIDFromProgID
                GetActiveObject on class ID.
                QueryInterface to get IDispatch interface.
Dim x As New interface  Find CLSID for interface.
                        CoCreateInstance
                        QueryInterface

Quote:
> >  Iakovos Karakas wrote in article

> > l.ntua.gr>...
> > >Hello all,
> > >I am looking for a sample code (or directions to related articles) on
> how
> > >can I call a VB DLL
> > >from a C/C++ program.
> [...]



Fri, 14 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

Quote:


> > Hello all,
> > I am looking for a sample code (or directions to related articles) on how
> > can I call a VB DLL
> > from a C/C++ program. If you have also any comments on how this VB DLL can
> > be called from other MS languages like FORTRAN don't hesitate to send them
> > too.
> > Thanks in advance

> > Iakovos Karakas


> What do you mean a "VB DLL" VBRUN300.DLL?

No. With VB 4.0 and 5.0 you can make dll's . I believe he wants to know
what the callign convention is. In this case it is same convention as
VC++ as the Dlls are compiled the same way.

Dave



Wed, 19 Jan 2000 03:00:00 GMT  
 Calling VB DLLs from VC/C++

Quote:



> > > Hello all,
> > > I am looking for a sample code (or directions to related articles) on how
> > > can I call a VB DLL
> > > from a C/C++ program. If you have also any comments on how this VB DLL can
> > > be called from other MS languages like FORTRAN don't hesitate to send them
> > > too.
> > > Thanks in advance

> > What do you mean a "VB DLL" VBRUN300.DLL?
> No. With VB 4.0 and 5.0 you can make dll's . I believe he wants to know
> what the calling convention is. In this case it is same convention as
> VC++ as the Dlls are compiled the same way.

Actually, I think they use the Pascal calloing convention.
The real question is: Why????  Why would anyone want to call *slow*
Visual Basic routines for C or C++.  Now the other way would make
sense.  I use VB to produce the UI and call C routines for speed.

--
*********************************************************

* Supporter of the campaign against grumpiness on c.l.c *
*********************************************************
The habit of viewing things cheerfully,
and of thinking of life hopefully,
may be made to grow up in us like any other habit.
                                    Matthew Arnold



Wed, 19 Jan 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Calling VB DLLs from VC/C++

2. VB 5.0 calling C++ 5.0 DLL that calls winsock.dll

3. Creating DLLs with VC/C++ for VB

4. vb calls vc dll and strings get chopped

5. Problems calling a VC DLL from VB

6. calling VC DLL from VB

7. Calling VC++ programs and VC created dlls from VB

8. Calling C DLLs with VB/VC 5

9. can you create a dll in VB and call in VC

10. VB Call to VC DLL

11. callbacks (VB calls a VC DLL)

12. vb calling vc dll :csaa

 

 
Powered by phpBB® Forum Software