Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking C++ code to a VB User Interface

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
I just wondered if it was possible to design a front end (GUI) in VB and link it to Visual C++ code.

Your advice would be very much appreciated :)
 
Yes with the use of ActiveX/COM components. Look for info on creating an ActiveX dll.
 
I have some example code of how to import C++ DLL functions to a VB front end, let me know if this is what you need.
 
I'd really appreciate it if u could send me that code. It will probably help me out big-time! Thanx mate! :)
 
This uses specific string variables but this can be modified for other types:

put this call under Option Explicit:

Private Declare Function Compile Lib "YourDLLName.dll" (ByVal FilePath1 As String, ByVal FilePath2 As String, ByVal CodeValue As String) As Long


Function called in C++ DLL:
This function should be declared in your exports (.def) also

bool _stdcall Compile(LPCTSTR filepath, LPCTSTR filepath, LPCTSTR codevalue)


The function is then called by an event in VB program, button click or whatever

Compile(App.Path + "\" + txt1.Text + ".txt", App.Path + "\" + txt2.Text + ".txt", txtCode.Text)


And of course the C++ DLL would be in your computer's system folder.
 
I've had better luck creating an OCX. file using the MFC ActiveX control wizard and importing thru VB properties -> references

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top