因为要做程序后段的批处理,考虑到软件被关闭或者其他的潜在因素影响运行结果,考虑使用锁屏的方式。最本质是为了装B一把,呵呵~~~先讲下原理
因为是自动从网上获取数据,考虑网络的延迟等原因,所以先批量输入查询参数,然后通过结束按钮来跳转到批量处理窗口,此时软件开始锁屏。frm1:只用来收集所有的参数数据到XML,通过按钮激活frm2锁屏后自动处理
frm2:通过参数截取网页数据相关代码:
结束按钮触发窗口跳转代码private void button1_click(object sender, EventArgs e)
{
  this.Hide();
  frm2 block = new frm2();
  block.show();
}
frm2代码        public frmGetData()
        {
            InitializeComponent();
            RegistryKey r = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies", true);
            r.CreateSubKey("System");
            r.Close();
            RegistryKey s = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System", true);
            s.SetValue("DisableTaskMgr", 1);
            s.Close();
            this.lblWarn.Location = new Point(panel1.Location.X - 50, panel1.Location.Y - 60);
            //通过代理抓取网页数据
            GetDateFromInternet();
        }        protected override void WndProc(ref   Message m)
        {
            base.WndProc(ref   m);
            if (m.Msg == 0x84)     //不让拖动标题栏   
            {
                if ((IntPtr)2 == m.Result)
                    m.Result = (IntPtr)1;
            }
            if (m.Msg == 0x00A3)       //双击标题栏无反应   
                m.WParam = System.IntPtr.Zero;        }
现在问题是,frm2的界面要到处理完 GetDateFromInternet()之后才跳出来,而不是开始处理前就跳出来,不知道怎么回事。请各位帮忙看看