Solved

VB & C++ communication

Posted on 1998-12-28
8
201 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
  • 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
 

Author Comment

by:andreat
ID: 1452823
sorry but i can't use your advice due to my comment above.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Share codes 68 115
Access 2016 VB code 9 86
DIR issue 7 47
Using an encrypted  value to decrypt and display contents in vb6 9 29
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now