示例#1
0
        private void btCapture_Click(object sender, EventArgs e)
        {
            Bitmap bp = Win32Locator.CaptureScreen();

            if (bp != null)
            {
                try
                {
                    bp.Save("shuikong-screen.jpg", ImageFormat.Jpeg);
                    MessageBox.Show("屏幕信息保存在 shuikong-screen.jpg, 请发送给技术部门分析");
                }
                catch (Exception ex) {
                    MessageBox.Show("保存失败 " + ex.Message);
                }
            }
        }
示例#2
0
        private Boolean collectWndEnv(string v)
        {
            IntPtr wnd = Win32Locator.locateWindow(String.Format("S({0:S})[0]", v), null);

            if (wnd == IntPtr.Zero)
            {
                MessageBox.Show(String.Format("定位窗口 {0:s} 失败", v));
                return(false);
            }
            try
            {
                String fn = "shuikong-screen.jpg";
                Win32Locator.SetForeGWindow(wnd);
                Win32Locator.centerWindow(wnd);
                Bitmap       pic     = Win32Locator.CaptureScreen();
                MemoryStream mStream = new MemoryStream();
                pic.Save(mStream, ImageFormat.Jpeg);
                WebClient w_cli = new WebClient();
                String    url   = string.Format("{0:s}log?client_id={1:s}&name={2:d}", ConfigurationManager.AppSettings["service_url"], Program.mAppCode, fn);
                w_cli.UploadData(new Uri(url), mStream.ToArray());
                MessageBox.Show("上载文件成功,请联系技术支持生成配置文件");
            }
            catch (IOException e)
            {
                MessageBox.Show("写文件错误,请检查磁盘空间");
                return(false);
            }
            catch (WebException e)
            {
                MessageBox.Show("上载文件失败,请联系技术支持");
                return(false);
            }
            catch (Exception e) {
                MessageBox.Show("系统异常");
                return(false);
            }
            return(true);
        }