Пример #1
0
        private void BookCaptureMainForm_Load(object sender, EventArgs e)
        {
            SystemFunction.KeyboardHookingStart(this); //후킹 프로세스 시작

            // 원래 Form 크기 저장
            mainFormPosition = new Point(this.Left, this.Top);
            mainFormSize     = new Size(this.Width, this.Height);
        }
Пример #2
0
 public void SetPressedKey() // 설정된 키 보이기
 {
     TxtKeyValue.Text      = SystemFunction.GetPressedKey().ToString();
     TxtKeyValue.BackColor = SystemColors.ControlLight;
     BtnSetKey.Enabled     = true;
 }
Пример #3
0
        private void CaptureEvent(object sender, EventArgs e) //타이머 이벤트
        {
            logger.Info("Cpature Macro Start");

            Bitmap capturedImg = captureBoxForm.CaptureImg();

            logger.Info("Image Captured");

            BitmapStatus status = ProofBitmap(prevBmap, capturedImg);

            if (status == BitmapStatus.Defalt || status == BitmapStatus.Normal)
            {
                //string fileName = DateTime.Now.ToString("yyyyMMddHHmmssffffff") + ".jpg";

                //capturedImg.Save(TxtSaveFolder.Text + @"\" + fileName, ImageFormat.Jpeg);

                //logger.Info("Image File Name : " + fileName);

                //logger.Info("Image Complete");

                MemoryStream stream = new MemoryStream();
                capturedImg.Save(stream, ImageFormat.Bmp);
                pdfMaker.AddPdfPage(stream.ToArray());

                logger.Info("A page add to pdf file");

                PbCapturedImg.Image = capturedImg;

                logger.Info("Set a Thumbnail");

                timerCount++;
                TxtRepeatCnt.Text = timerCount.ToString();

                logger.Info("Page Count : " + timerCount.ToString());

                PgbMacro.PerformStep();

                prevBmap = capturedImg;
            }
            else if (status == BitmapStatus.Duplicate || status == BitmapStatus.Empty || status == BitmapStatus.CurImgVacant) // 중복이거나 내용이 없을 경우, 캡쳐한 이미지가 null 일경우 건너뜀
            {
                logger.Warn("Capture Process Skiped / Skiped by : " + status.ToString());

                logger.Info("Retry to capture / try to act macro");

                ProcessSwiching.Swiching(targetWindowHandle);

                logger.Info("ProcessSwiching Complete");

                SystemFunction.VKeyPress(TxtKeyValue.Text);
                logger.Info("Macro Key Pressed");

                return;
            }
            else
            {
                logger.Error("Image Capture Macro Error / Bitmap Status : " + status.ToString());
                MacroTimerStop();
            }


            if (timerCount >= Int32.Parse(TxtRepeatTime.Text)) // 정해진 카운트를 채웠을 경우 종료
            {
                MacroTimerStop();
                logger.Info("Timer Event End");
            }
            else
            {
                ProcessSwiching.Swiching(targetWindowHandle);

                logger.Info("ProcessSwiching Complete");

                SystemFunction.VKeyPress(TxtKeyValue.Text);
                logger.Info("Macro Key Pressed");
            }
        }
Пример #4
0
 private void BookCaptureMainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     SystemFunction.KeyboardHookingStop(); //후킹 종료
 }