Пример #1
0
        private bool startCapture()
        {
            OkApi.SetToWndRect(hBoard, picMain.Handle);
            int ret = OkApi.CaptureToScreen(hBoard);

            return(ret > 0);
        }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();
            int index = -1;

            hBoard = OkApi.OpenBoard(ref index);
            Debug.Assert(hBoard.ToInt32() != 0);

            OkApi.SetCaptureParam(hBoard, (ushort)ECapture.CAPTURE_CLIPMODE, 0); // 缩放方式
            string      hostname = Dns.GetHostName();
            IPHostEntry ips      = Dns.GetHostEntry(hostname);

            foreach (IPAddress ip in ips.AddressList)
            {
                txLocalIp.Text += ip.ToString() + "\n";
            }

            addGroupButtons();
            timerUpdate.Enabled = true;
        }
Пример #3
0
        private void saveFile()
        {
            basefilename = string.Format(@"{0}.jpg", DateTime.Now.ToString("yyyyMMdd_HHmmss_ffffff"));
            String filename = Application.StartupPath + "\\" + basefilename;
            int    filesize = OkApi.SaveImageFile(hBoard, filename,
                                                  80, OkApi.TARGET_SCREEN, 0, 1);

            if (filesize > 0)
            {
                currentImage = File.ReadAllBytes(filename);
                FileStream fs      = File.OpenRead(filename);
                Bitmap     picture = new Bitmap(fs);
                picMain.Image = (Image)picture;
                fs.Close();
                File.Delete(filename);
            }
            else
            {
                Console.WriteLine(OkApi.GetLastError(hBoard));
            }
        }
Пример #4
0
 private void stopCapture()
 {
     OkApi.StopCapture(hBoard);
 }
Пример #5
0
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            int result = OkApi.CloseBoard(hBoard);

            Console.WriteLine(result);
        }