Solved

VB & C++ communication

Posted on 1998-12-28
8
217 Views
Last Modified: 2010-05-03
hi,
I would like to enquire abt the following:
1) My GUI is in VB
2) My callback functions are in C++

Is DLL the only way to communicate between the 2, i.e. i compile the C++ functions as a dll?
Or can i compile the C++ and use the object files *.o for compilation with the VB application?
Or are there any better ways?

Please advise.
Thanks.
0
Comment
Question by:andreat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 4

Expert Comment

by:idcanada
ID: 1452820
DLL is NOT the only way but a very good way, therefore used by most programmers.

In your case, for max preformance,
convert your C++ callbacks to VB. If you do not wish to do this,
have the GUI constructed with C++.

1 Language should be your focus here.



0
 

Author Comment

by:andreat
ID: 1452821
hi,
due to the complexity of the project and the little time left,
i have to stick to using VB for GUI and VC++ for callbacks.

as such, would appreciate it if u can recommend other methods
where I can satisfy the above requirements and the program can work. can i compile of C++'s object files instead of dll?

andrea
0
 

Author Comment

by:andreat
ID: 1452822
hi,
due to the complexity of the project and the little time left,
i have to stick to using VB for GUI and VC++ for callbacks.

as such, would appreciate it if u can recommend other methods
where I can satisfy the above requirements and the program can work. can i compile of C++'s object files instead of dll?


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:andreat
ID: 1452823
sorry but i can't use your advice due to my comment above.
0
 

Accepted Solution

by:
Billaban earned 10 total points
ID: 1452824
If U can't change what is done, i.e.,  your stuck with VB GUI and VC plumbing.  U should be using COM.  Callbacks are COM Connection points.  In a nutshell, U make the C++ a COM server DLL and set a reference to it in your VB app.  Instantiate the server object and establish the connection point for the functional equivalent to a callback.  If U don't know anything about COM U better learn it if U want to survive writing code that traverses language boundaries.  I'm guessing U won't like this answer, since it is not a magical solution, but so be it.  With experience in ATL U could write the server in a few hours, but the first time around is pretty painful.

HTH
0
 

Author Comment

by:andreat
ID: 1452825
thanks for ur advice, though u sound as if I've offended u in some way or another.
0
 

Expert Comment

by:Billaban
ID: 1452826
No not at all. I simply perceived frustration in your query and presumed a response burdening U with a new learning curve would not be what U wanted to here.  The gospel documents of COM and COM/VB  are Dale Rogerson's  Inside COM,  Dan Appleman's COM/ActiveX book, and basic COM tutorial would be Don Box's Essential COM.  COM is not the easiest thing to learn... buy some books and digest them.

HTH
0
 

Author Comment

by:andreat
ID: 1452827
hi,
i guess my frustrations showed in my msg. time is running out on me :)
irregardless, thanks for your help.

andrea
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best way to parse out a json string in VB6? 10 293
Sending a email via excel using vba 6 110
Excel - Save a copy of work book 13 91
Copy a row 12 70
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question