MessageBox不会在Windows 7 Embedded中显示

5Yr*_*DBA 5 .net c# windows-embedded windows-7-embedded

考虑一个MessageBox来提示用户回答是或否.它适用于我们的XP机器和一台Windows 7构建机器.

但是,它不适用于我们的Windows 7 Embedded机器.没有错误消息,没有MessageBox显示.它只是假设用户单击了Yes按钮,因为我可以找到从那里创建的调试文件,并且createDatabase();在没有任何messageBox之前调用它.

我可以找到MessageBox所需的程序集(System.Windows.Forms.dll).它与我们的Windows 7构建机器位于同一位置.你知道为什么吗?谢谢

DialogResult result = System.Windows.Forms.MessageBox.Show(
    "Do you want to update your database?\nWarning: All your data will be erased if you click Yes !",
"Update Database",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);

if (result == DialogResult.Yes)
{
    string[] cmdLines2 = { @"C:\AndeDB\AndeDB.db is here and selected yes" };
    //it will create, open and write or overwrite
    File.WriteAllLines(@"C:\Temp\dbcheck2.txt", cmdLines2);
    createDatabase();
}
Run Code Online (Sandbox Code Playgroud)

SwD*_*n81 5

这篇文章中,您可以禁用Windows 7 Embedded中的"消息框默认回复"组件.更多细节可以在msdn上找到.