求教dll中使用PostQuitMessage(0)导致c#调用程度退出的问题
如题, 我用vc出了一个win32的dll, 在dll里createwindow了一个窗体, 在窗体中有退出按扭并且调用了PostQuitMessage(0), 我用mfc用的调用exe是完全没有问题的, 但放到别人用c#写的调用exe的时候, 点了退出按扭连调用的exe也退出了
c#代码
namespace VideoCommiTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void menuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
[DllImport("VideoMonitor\\a.dll")]
public static extern int InstanceVCIP(int nUserID, string szPwd, int nMode);
[DllImport("VideoMonitor\\a.dll")]
public static extern bool UpdateWindowVCIP(int nType);
[DllImport("VideoMonitor\\a.dll")]
public static extern void ExitVCIP();
private void button1_Click(object sender, EventArgs e)
{
int nID = 200001000;
string szPwd = "12345";
int nMode = 0;
InstanceVCIP(nID, szPwd, nMode);
}
}
}
请大家指教一下,我要怎么样退出dll而不会退出调用的c# exe
[解决办法]
PostQuitMessage MFC当中没问题吗,这个API就是会退程序的,建议用DESTORYWINDOW
[解决办法]
Application.Exit();程序就彻底结束了
用this.close();