在Win7下要通过某个 线程 来调用SavaDialog文件选择框的问题

如果 在Win7下要通过某个 线程 来调用SavaDialog文件选择框的代码  选择窗口 有时会出不来 需要设置如下:
    ThreadthreadOfRec = new Thread(ReciveMsg);
                threadOfRec.SetApartmentState(ApartmentState.STA);
                threadOfRec.IsBackground = true;
                threadOfRec.Start();

SaveFileDialog sfd = new SaveFileDialog();
                        if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            using (FileStream fs = new FileStream(sfd.FileName, FileMode.OpenOrCreate))
                            {
                                fs.Write(msgRecived, 1, length - 1);
                                MessageBox.Show("文件写入成功!!!");
                            }
                        }

上一篇:Linux脚本中使用特定JDK


下一篇:Struts2 运行流程