⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.h

📁 Using mirror driver as filter driver in capture desktop screen operation allow system run faster tha
💻 H
📖 第 1 页 / 共 2 页
字号:
#pragma once

#include <windows.h>
#include "FreeImage.h"

//#define FULLSCREEN 1


namespace Test2 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::Drawing::Drawing2D;
	using namespace System::Runtime::InteropServices;
	using namespace System::Threading;

	public struct MessageData
	{
	public:
		IntPtr hWnd;
		unsigned int message;
		IntPtr wParam;
		IntPtr lParam;
		unsigned int time;
		unsigned long PointX;
		unsigned long PointY;
	};
	public enum SetCallBackResults
		{
			Success			= 1,
			AlreadySet		= -2,
			NotImplemented	= -3,
			ArgumentError	= -4
		};

	
	/// <summary>
	/// Form1 偺奣梫
	///
	/// 寈崘: 偙偺僋儔僗偺柤慜傪曄峏偡傞応崌丄偙偺僋儔僗偑埶懚偡傞偡傋偰偺 .resx 僼傽僀儖偵娭楢晅偗傜傟偨
	///          儅僱乕僕 儕僜乕僗 僐儞僷僀儔 僣乕儖偵懳偟偰 'Resource File Name' 僾儘僷僥傿傪
	///          曄峏偡傞昁梫偑偁傝傑偡丅偙偺曄峏傪峴傢側偄偲丄
	///          僨僓僀僫偲丄偙偺僼僅乕儉偵娭楢晅偗傜傟偨儘乕僇儔僀僘嵪傒儕僜乕僗偲偑丄
	///          惓偟偔憡屳偵棙梡偱偒側偔側傝傑偡丅
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: 偙偙偵僐儞僗僩儔僋僞 僐乕僪傪捛壛偟傑偡
			//
			strFileMemory = "C:\\test.dat";
		}

	protected:
		/// <summary>
		/// 巊梡拞偺儕僜乕僗傪偡傋偰僋儕乕儞傾僢僾偟傑偡丅
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::GroupBox^  grpTesting;
	protected: 





















	private: System::Windows::Forms::Button^  btnSync;




	private: System::Windows::Forms::Panel^  panel1;
	private: System::Windows::Forms::PictureBox^  picDesktop;
	private: System::Windows::Forms::GroupBox^  grpInitialize;


	private: System::Windows::Forms::Button^  btnActiveMirror;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::TextBox^  txtFrame;

	private: System::Windows::Forms::GroupBox^  grpResult;
	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::Label^  lblTotalFrame;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::TextBox^  txtTime;

	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::TextBox^  txtJpegQuality;

	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::GroupBox^  grpFreeImage;
	private: System::Windows::Forms::Button^  btnFI_Load;

	private: System::ComponentModel::IContainer^  components;





	protected: 

	private:
		/// <summary>
		/// 昁梫側僨僓僀僫曄悢偱偡丅
		/// </summary>


#pragma region Windows Form Designer generated code
		/// <summary>
		/// 僨僓僀僫 僒億乕僩偵昁梫側儊僜僢僪偱偡丅偙偺儊僜僢僪偺撪梕傪
		/// 僐乕僪 僄僨傿僞偱曄峏偟側偄偱偔偩偝偄丅
		/// </summary>
		void InitializeComponent(void)
		{
			this->grpTesting = (gcnew System::Windows::Forms::GroupBox());
			this->txtJpegQuality = (gcnew System::Windows::Forms::TextBox());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->txtTime = (gcnew System::Windows::Forms::TextBox());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->grpResult = (gcnew System::Windows::Forms::GroupBox());
			this->lblTotalFrame = (gcnew System::Windows::Forms::Label());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->txtFrame = (gcnew System::Windows::Forms::TextBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->btnSync = (gcnew System::Windows::Forms::Button());
			this->panel1 = (gcnew System::Windows::Forms::Panel());
			this->picDesktop = (gcnew System::Windows::Forms::PictureBox());
			this->grpInitialize = (gcnew System::Windows::Forms::GroupBox());
			this->btnActiveMirror = (gcnew System::Windows::Forms::Button());
			this->grpFreeImage = (gcnew System::Windows::Forms::GroupBox());
			this->btnFI_Load = (gcnew System::Windows::Forms::Button());
			this->grpTesting->SuspendLayout();
			this->grpResult->SuspendLayout();
			this->panel1->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->picDesktop))->BeginInit();
			this->grpInitialize->SuspendLayout();
			this->grpFreeImage->SuspendLayout();
			this->SuspendLayout();
			// 
			// grpTesting
			// 
			this->grpTesting->Controls->Add(this->txtJpegQuality);
			this->grpTesting->Controls->Add(this->label6);
			this->grpTesting->Controls->Add(this->label5);
			this->grpTesting->Controls->Add(this->txtTime);
			this->grpTesting->Controls->Add(this->label4);
			this->grpTesting->Controls->Add(this->grpResult);
			this->grpTesting->Controls->Add(this->label2);
			this->grpTesting->Controls->Add(this->txtFrame);
			this->grpTesting->Controls->Add(this->label1);
			this->grpTesting->Controls->Add(this->btnSync);
			this->grpTesting->Location = System::Drawing::Point(7, 62);
			this->grpTesting->Name = L"grpTesting";
			this->grpTesting->Size = System::Drawing::Size(200, 221);
			this->grpTesting->TabIndex = 1;
			this->grpTesting->TabStop = false;
			this->grpTesting->Text = L"Testing";
			// 
			// txtJpegQuality
			// 
			this->txtJpegQuality->Location = System::Drawing::Point(81, 65);
			this->txtJpegQuality->Name = L"txtJpegQuality";
			this->txtJpegQuality->Size = System::Drawing::Size(73, 20);
			this->txtJpegQuality->TabIndex = 7;
			this->txtJpegQuality->Text = L"10";
			// 
			// label6
			// 
			this->label6->AutoSize = true;
			this->label6->Location = System::Drawing::Point(6, 68);
			this->label6->Name = L"label6";
			this->label6->Size = System::Drawing::Size(63, 13);
			this->label6->TabIndex = 6;
			this->label6->Text = L"Jpeg quality";
			// 
			// label5
			// 
			this->label5->AutoSize = true;
			this->label5->Location = System::Drawing::Point(155, 42);
			this->label5->Name = L"label5";
			this->label5->Size = System::Drawing::Size(26, 13);
			this->label5->TabIndex = 5;
			this->label5->Text = L"(ms)";
			// 
			// txtTime
			// 
			this->txtTime->Location = System::Drawing::Point(81, 39);
			this->txtTime->Name = L"txtTime";
			this->txtTime->Size = System::Drawing::Size(73, 20);
			this->txtTime->TabIndex = 4;
			this->txtTime->Text = L"10";
			// 
			// label4
			// 
			this->label4->AutoSize = true;
			this->label4->Location = System::Drawing::Point(6, 42);
			this->label4->Name = L"label4";
			this->label4->Size = System::Drawing::Size(56, 13);
			this->label4->TabIndex = 3;
			this->label4->Text = L"Sleep time";
			// 
			// grpResult
			// 
			this->grpResult->Controls->Add(this->lblTotalFrame);
			this->grpResult->Controls->Add(this->label3);
			this->grpResult->Location = System::Drawing::Point(5, 161);
			this->grpResult->Name = L"grpResult";
			this->grpResult->Size = System::Drawing::Size(188, 54);
			this->grpResult->TabIndex = 9;
			this->grpResult->TabStop = false;
			this->grpResult->Text = L"Result";
			// 
			// lblTotalFrame
			// 
			this->lblTotalFrame->AutoSize = true;
			this->lblTotalFrame->Location = System::Drawing::Point(72, 16);
			this->lblTotalFrame->Name = L"lblTotalFrame";
			this->lblTotalFrame->Size = System::Drawing::Size(13, 13);
			this->lblTotalFrame->TabIndex = 1;
			this->lblTotalFrame->Text = L"1";
			// 
			// label3
			// 
			this->label3->AutoSize = true;
			this->label3->Location = System::Drawing::Point(6, 16);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(53, 13);
			this->label3->TabIndex = 0;
			this->label3->Text = L"Total time";
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(155, 16);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(44, 13);
			this->label2->TabIndex = 2;
			this->label2->Text = L"(frames)";
			// 
			// txtFrame
			// 
			this->txtFrame->Location = System::Drawing::Point(81, 13);
			this->txtFrame->Name = L"txtFrame";
			this->txtFrame->Size = System::Drawing::Size(73, 20);
			this->txtFrame->TabIndex = 1;
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(6, 16);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(76, 13);
			this->label1->TabIndex = 0;
			this->label1->Text = L"Running frame";
			// 
			// btnSync
			// 
			this->btnSync->Enabled = false;
			this->btnSync->Location = System::Drawing::Point(5, 132);
			this->btnSync->Name = L"btnSync";
			this->btnSync->Size = System::Drawing::Size(75, 23);
			this->btnSync->TabIndex = 8;
			this->btnSync->Text = L"&Test";
			this->btnSync->UseVisualStyleBackColor = true;
			this->btnSync->Click += gcnew System::EventHandler(this, &Form1::btnSync_Click);
			// 
			// panel1
			// 
			this->panel1->AutoScroll = true;
			this->panel1->Controls->Add(this->picDesktop);
			this->panel1->Location = System::Drawing::Point(213, 12);
			this->panel1->Name = L"panel1";
			this->panel1->Size = System::Drawing::Size(662, 517);
			this->panel1->TabIndex = 3;
			// 
			// picDesktop
			// 
			this->picDesktop->Location = System::Drawing::Point(5, 1);
			this->picDesktop->Name = L"picDesktop";
			this->picDesktop->Size = System::Drawing::Size(640, 480);
			this->picDesktop->TabIndex = 0;
			this->picDesktop->TabStop = false;
			// 
			// grpInitialize
			// 
			this->grpInitialize->Controls->Add(this->btnActiveMirror);
			this->grpInitialize->Location = System::Drawing::Point(7, 5);
			this->grpInitialize->Name = L"grpInitialize";
			this->grpInitialize->Size = System::Drawing::Size(200, 51);
			this->grpInitialize->TabIndex = 0;
			this->grpInitialize->TabStop = false;
			this->grpInitialize->Text = L"Initialization";
			// 
			// btnActiveMirror
			// 
			this->btnActiveMirror->Location = System::Drawing::Point(6, 19);
			this->btnActiveMirror->Name = L"btnActiveMirror";
			this->btnActiveMirror->Size = System::Drawing::Size(75, 23);
			this->btnActiveMirror->TabIndex = 0;
			this->btnActiveMirror->Text = L"&Active mirror";
			this->btnActiveMirror->UseVisualStyleBackColor = true;
			this->btnActiveMirror->Click += gcnew System::EventHandler(this, &Form1::btnActiveMirror_Click);
			// 
			// grpFreeImage
			// 
			this->grpFreeImage->Controls->Add(this->btnFI_Load);
			this->grpFreeImage->Location = System::Drawing::Point(7, 289);
			this->grpFreeImage->Name = L"grpFreeImage";
			this->grpFreeImage->Size = System::Drawing::Size(200, 100);
			this->grpFreeImage->TabIndex = 2;
			this->grpFreeImage->TabStop = false;
			this->grpFreeImage->Text = L"Free Image library";
			// 
			// btnFI_Load
			// 
			this->btnFI_Load->Enabled = false;
			this->btnFI_Load->Location = System::Drawing::Point(9, 19);
			this->btnFI_Load->Name = L"btnFI_Load";
			this->btnFI_Load->Size = System::Drawing::Size(75, 23);
			this->btnFI_Load->TabIndex = 9;
			this->btnFI_Load->Text = L"&Load";
			this->btnFI_Load->UseVisualStyleBackColor = true;
			this->btnFI_Load->Click += gcnew System::EventHandler(this, &Form1::btnFI_Load_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->AutoScroll = true;
			this->ClientSize = System::Drawing::Size(878, 562);
			this->Controls->Add(this->grpFreeImage);
			this->Controls->Add(this->grpInitialize);
			this->Controls->Add(this->panel1);
			this->Controls->Add(this->grpTesting);
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::SizableToolWindow;
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &Form1::Form1_FormClosed);
			this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
			this->grpTesting->ResumeLayout(false);
			this->grpTesting->PerformLayout();
			this->grpResult->ResumeLayout(false);
			this->grpResult->PerformLayout();
			this->panel1->ResumeLayout(false);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->picDesktop))->EndInit();
			this->grpInitialize->ResumeLayout(false);
			this->grpFreeImage->ResumeLayout(false);
			this->ResumeLayout(false);

		}
#pragma endregion
	public:	delegate int HookProc(int code, IntPtr wParam, IntPtr lParam);
	public: static int SCREEN_WIDTH = 800;
	public: static int SCREEN_HEIGHT = 600;
		//gdi32.dll
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
	static bool BitBlt(IntPtr hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,IntPtr hdcSrc,
		int nXSrc,int nYSrc,Int32 dwRop);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
	static bool StretchBlt (IntPtr hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,
		IntPtr hdcSrc,int nXSrc,int nYSrc,int nSrcWidth,int nSrcHeight,Int32 dwRop);

	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr CreateCompatibleDC(IntPtr hdc);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr CreateCompatibleBitmap (IntPtr hdc,int width,int height);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr DeleteDC(IntPtr hDc);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
		static IntPtr DeleteObject(IntPtr hDc);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
		static IntPtr SelectObject(IntPtr hdc,IntPtr bmp);
	public:	[DllImport("Gdi32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
		static int SetStretchBltMode(IntPtr hdc,int iStretchMode);


		//user32.dll
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr GetDesktopWindow(void);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr GetDC(IntPtr Hwnd);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static int GetSystemMetrics(int abc);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr GetWindowDC(Int32 ptr);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDc);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static short GetKeyState(int keyCode);
	public:	[DllImport("user32.dll", CharSet = CharSet::Auto, 
			BestFitMapping = true,CallingConvention = CallingConvention::Cdecl)]
			static BOOL GetWindowRect(IntPtr hWnd,LPRECT lpRect);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -