1.修改MFC项目属性支持CLR

mfc调用WPFDLL-LMLPHP

2.打开vcxproj,修改<PropertyGroup Label="Globals">

<PropertyGroup Label="Globals">

<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>

<ProjectGuid>{54D1ECDB-7A36-487B-BB02-09775988C423}</ProjectGuid>

<SccProjectName>SAK</SccProjectName>

<SccAuxPath>SAK</SccAuxPath>

<SccLocalPath>SAK</SccLocalPath>

<SccProvider>SAK</SccProvider>

<Keyword>Win32Proj</Keyword>

<RootNamespace>MFCApplication1</RootNamespace>

<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>

<Keyword>MFCProj</Keyword>

</PropertyGroup>

3.复制DLL到exe目录下,添加引用,DLL的引用,其他引用需与WPF中的相同

mfc调用WPFDLL-LMLPHP

4.在App的InitInstance()中添加代码

lwm_Login::MainWindow ^login = gcnew lwm_Login::MainWindow();
login->ShowDialog();

大功告成

mfc调用WPFDLL-LMLPHP

05-07 15:30