主题:Windows服务中打开一个新窗体后就死了
我做了一个Windows服务程序,在服务中用线程打开一个窗体,但打开窗体后,窗体就死了,没有任何反应,窗体上的控件也没有,这是为什么呢?下面是线程代码:
public static void ThreadFunc()
{
while (true)
{
System.Threading.Thread.SpinWait(10 * 1000);
string msg = "打开了";
if (msg != "")
{
ReminderForm rf = new ReminderForm();
rf.msg1 = msg;
rf.Show();
}
}
}
public static void ThreadFunc()
{
while (true)
{
System.Threading.Thread.SpinWait(10 * 1000);
string msg = "打开了";
if (msg != "")
{
ReminderForm rf = new ReminderForm();
rf.msg1 = msg;
rf.Show();
}
}
}