-3

I have a console application in C++ in Microsoft Visual Studio 2010, what i want is to add a Windows form to the project and show the out of the console application on the form. let suppose my console application code is

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
int x, y;
x=y=10;
printf("%d",x*y);
return 0;
}

kindly guide me how this problem can be solved

WiXXeY
  • 981
  • 5
  • 19
  • 46
  • You're the second person to ask that in the last couple hours. I think this is helpful advice: http://stackoverflow.com/questions/8072292/trouble-converting-a-console-application-to-a-wpf-application-in-vs-2010 – dcaswell Aug 27 '13 at 05:21
  • What version of Visual Studio do you have? If you have Professional of higher you can take a look at MFC Microsoft Foundation Classes. – MathiasWestin Aug 27 '13 at 05:52

1 Answers1

3

Forms are part of the .NET framework. That's not available to Standard C++ code. You need to use "Managed C++", and for that you need to create your project using one of the CLR templates under the C++ subtree. If you want a real console window, but maybe also want to create forms, use CLR Console Project. For a GUI application with everything in forms, use CLR Blank Project and then add forms.

Sounds easy, but MS doesn't make it so. There's not a lot of how-to-make-it for Managed C++ Forms, and you'll probably get your most useful information googling outside of MSDN.

If you want to develop forms applications under Windows, the languages to use are C# or VB. C# is my recommendation, as it is the only language designed from the ground up as a .NET language.

Mike Housky
  • 3,959
  • 1
  • 17
  • 31