C++如何调用C#窗体封装的dll
C#代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;us...
C#代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ClassLibrary1{ public class ClassDlg { public void ShowDalg() { Form1 f1 = new Form1(); f1.ShowDialog(); } }}C++代码:#include <iostream>#include <string>//#using "C:\\Users\\10027\\Documents\\visual studio 2015\\Projects\\Project1\\Debug\\ClassLibrary1.dll"#using "C:\Users\10027\Documents\Visual Studio 2015\Projects\Project1\Debug\ClassLibrary1.dll"using namespace std;using namespace ClassLibrary1;int main(){ ClassDlg ^ classdlg = gcnew ClassDlg; classdlg->ShowDalog(); system("pause"); return 0;}为什么运行时没有显示窗口
展开
1个回答
展开全部
控制台调用窗体不是这么用的。第一个窗体要用Application::Run打开
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew ClassDlg());
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询