kevin.jztan

i m trying to using .NET framwork in MFC,

i had add following code to stdafx.h

Code Snippet

#using

#using

#using

using namespace System;

using namespace System::Windows::Forms;

using namespace System::Security::Cryptography;

#undef MessageBox

and turn on the /clt. (http://msdn2.microsoft.com/en-us/library/ms235211(VS.80).aspx)

but i still got error like,

Code Snippet
SHA1-TestBed-MFC error LNK2001: unresolved external symbol "public: long __thiscall CWnd::SendMessage(unsigned int,unsigned int,long)" ( SendMessage@CWnd@@$$FQAEJIIJ@Z)
SHA1-TestBed-MFC'>mailto: SendMessage@CWnd@@$$FQAEJIIJ@Z"> SendMessage@CWnd@@$$FQAEJIIJ@Z)
SHA1-TestBed-MFC fatal error LNK1120: 1 unresolved externals

can anyone help me with this issue

many thanks. ^^



Re: Visual C++ Language using .NET Framework in MFC

kevin.jztan

forgot to say that i'm using vc2003.





Re: Visual C++ Language using .NET Framework in MFC

Ramkrishna Pawar

And was this project MFC based earlier




Re: Visual C++ Language using .NET Framework in MFC

kevin.jztan

i just simply create a new MFC project with vc2003.

was that too earlier





Re: Visual C++ Language using .NET Framework in MFC

kevin.jztan

i just simply create a new MFC project with vc2003.

was that too earlier

thank u very much.





Re: Visual C++ Language using .NET Framework in MFC

Bite Qiu - MSFT

kevin.jztan wrote:

i just simply create a new MFC project with vc2003.

was that too earlier

I tried it following steps in VC2005, it works good:

1. Create a MFC Dialog based application use wizard

2. Add System.Windows.Forms and System.Security assembly to the reference of this project

3. Add following code in the end of stdafx.h file:

Code Snippet

using namespace System;

using namespace System::Windows::Forms;

using namespace System::Security::Cryptography;

4.Add following code to OnInitDialog() method:

Code Snippet

System::Windows::Forms::MessageBox::Show(_T("I am using .NET in MFC application:-)"));

5. Build and run, get message box correctly pop up.

Since VC2003 questions are off-topic here, and I don't have an VC2003 environment to reproduce the error, so I suggest you to upgrade to VC2005(if possible) or reference to following articles that may informative for your situation:

http://msdn2.microsoft.com/en-us/library/aa712571(VS.71).aspx

http://www.ddj.com/dept/windows/184416740

hope it helps

rico