Hi,

In brief, I have written a program in C++ that reads data from a text file, does 'stuff' with that data and then writes the results to a number of separate file. Separately I've written a simple GUI for this program using Visual Basic (allows the user to select the input file and choose where the output is saved). Now I want to link these together but google hasn't been much help :) I'm wondering is there anyway to call C++ code from within a windows forms application (my VB code), allowing me to pass the relevant filepaths between the two programs?

Thanks,

V

Awais Ali commented: This is very important and usefull add. +1

Recommended Answers

There is also the possibility of using P/Invoke, used to map calls to C/C++ using VB (http://msdn.microsoft.com/en-us/library/aa719104%28v=vs.71%29.aspx).

Jump to Post

All 5 Replies

The is more than one way:
1-pass the source and distination as parametars to c++ when you run it and handle the args in c++
2-use sendmessage From Vb to c++ and handle the recieve message in c++
3-write the data to config file near the c++ exe and on run read it
4-use plugin
that what i have in mind you can try any or find yours

Hi mazzica1, thanks for your reply. Could you possibly suggest where I might find further information on the approaches you suggested?

PS At the moment I have the VB GUI and the c++ projects in the same solution in Visual Studio.

Hi mazzica1, thanks for you're reply. I'm afraid I still don't know what the next step I should be taking is. Could you possibly suggest somewhere I might find further information on this. Google is just confusing me more and I'd be surprised if there isn't a reasonably straightforward way to do this.

PS At the moment I have both the VB GUI and the C++ program saved as two separate solutions in the same project file in Visual Studio

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.