By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,512 Members | 3,847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,512 IT Pros & Developers. It's quick & easy.

Integrate Windows Forms Application (.NET) with C++

P: n/a
I have 2 projects that can run independently. One is built using
Windows Forms Application (.NET) and the other is built on pure C++.

Both project runs fine, but when I try to integrate them, problems
arise. I create new Empty Project, and add the 2 existing project. As
for C++ project, most of the includes and coding is in .CPP file
whereas .H file only contain class definition. As for the form, it is
generated and most of the coding involves event handler is in .H file.
The CPP file contain only _tWinMain function which serves as starting
point of form.

Now, I added a global variable in the Form1.cpp

#include "...CCpp.h"
CCpp *obj;

I then insert this line into the _tWinMain function to create object

obj = new CCpp();

I compile and everything is fine. Now I add a button in Form1.h and
generate a button_click event handler. In the event handler, I try to
use the global pointer obj to call the method in CCpp class


When I compile again, it gives error 2065 ('obj' undeclared
identifier) and also error C2227 left of '->method1' must point to

The bottom line is, I just want to call C++ function from Windows Form
and vice versa (call Windows Form function from C++) but it seems that
integrating the 2 projects doesn't work well.

Please help me. Thank you.
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.