Hi
I am writing a simple C++ win32 console application, with only one .cpp file.

I want to show a windows form, for this i added a new windows form in my project, It said that i am adding CLR support in my project, i said ok and It created a windows form for me.

I have a question about how can i show that window form in my C++ code file, i have tried to include "myForm.h" file, but i got error that "Cannot open the include file, no such file or directory".

Also i want to access its controls for updating.
Please help

Thanks

Look in the directory in which the project is store -- the name of the header file is most likely Form1.h.

>>Also i want to access its controls for updating.
Don't know.

Are you sure you want to do this? by making your program support CLR, you're sacrificing alot of portability and adding some chaos to your program. .NET is good for rapid development of larger programs, what you want to do may be better accomplished using the Win32 API.

m_amin,
Your win32 project application is now converted into CLR application.

You have to replace Entry point main() of Win32 with CLR entry point definition,

#include "stdafx.h"
#include  "Form1.h"
using namespace System;
using namespace Win32app;  // put namespace of your project here

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

              // gcnew YourNameSpace::Form1()
	Application::Run(gcnew Win32app::Form1());
	return 0;
}

and set Linker property (Project Property)

Common Language RunTime Support : Safe MSIL Common Language Runtime Support (/clr:safe)
Be a part of the DaniWeb community

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