Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MessageBox doesn't show in Windows 7 Embedded

Consider a MessageBox to prompt the user to answer yes or no. It works in our XP machines and one Windows 7 build machine.

However, it doesn't work on our Windows 7 Embedded machine. There is no error message, no MessageBox shows up. It just assumes the user clicked the Yes button because I can find the debug file created from there and createDatabase(); is called without any messageBox ahead of it.

I can find the assembly (System.Windows.Forms.dll) which is required by the MessageBox. It is in the same location as our Windows 7 build machine. do you have any idea why? thanks

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();
}
like image 738
5YrsLaterDBA Avatar asked Nov 11 '10 21:11

5YrsLaterDBA


2 Answers

From this post, you could disable the "Message Box Default Reply" component from Windows 7 Embedded. Further details can be found on msdn.

like image 63
SwDevMan81 Avatar answered Nov 15 '22 05:11

SwDevMan81


The keyword here is "embedded". Such versions of Windows are often configured to run head-less (no monitor) or optimized to work without anybody being close. A MessageBox is poison to such a configuration. The machine stops running and nobody can find out why.

You need to go back to your system builder and find the option that controls this.

like image 29
Hans Passant Avatar answered Nov 15 '22 04:11

Hans Passant