如果 在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("文件写入成功!!!");
                            }
                        }

04-14 09:02