资源简介
屏幕截图 多屏 截窗口 十字放大 类似qq的截屏,不带编辑功能,说明截图中的技术
代码片段和文件信息
// CatchScreen.cpp : Defines the entry point for the application.
//
#include “stdafx.h“
#include “CatchScreen.h“
#pragma comment(lib“Msimg32.lib“)
#include
#include
using namespace Gdiplus;
#pragma comment(lib “gdiplus.lib“)
#pragma comment(lib “user32.lib“)
#pragma comment(lib “comctl32.Lib“)
#pragma comment(lib “gdi32.Lib“)
#pragma comment(linker “\“/manifestdependency:type=‘Win32‘ name=‘Microsoft.Windows.Common-Controls‘ version=‘6.0.0.0‘ processorArchitecture=‘X86‘ publicKeyToken=‘6595b64144ccf1df‘ language=‘*‘\““)
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR sztitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
INT_PTR CALLBACK About(HWND UINT WPARAM LPARAM);
HBITMAP m_oriHBitmap; // 背景位图
HBITMAP m_alphaHBitmap; // alphablend后的背景位图
HBITMAP m_bufferHBitmap;
BOOL m_bSnaping;
POINT m_startPoint = {-1-1};
POINT m_endPoint;
POINT m_lastPoint;
BOOL m_bMoving;
BOOL m_bCanResize;
BOOL m_bResizing;
POINT m_resizeStartPoint;
HMENU m_hMenu;
int resizeType;
TCHAR m_colorText[50];
HWND m_pointWnd;
UINT m_nTimerID;
BOOL m_hittest = FALSE;
BOOL m_bCaptureWindow = TRUE;
COLORREF m_screenCor = 0;
int APIENTRY _tWinMain(HINSTANCE hInstance
HINSTANCE hPrevInstance
LPTSTR lpCmdLine
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance IDS_APP_title sztitle MAX_LOADSTRING);
LoadString(hInstance IDC_CATCHSCREEN szWindowClass MAX_LOADSTRING);
MyRegisterClass(hInstance);
HRESULT hRes = ::CoInitialize(NULL);
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken &gdiplusStartupInput NULL);
// Perform application initialization:
if (!InitInstance (hInstance nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance MAKEINTRESOURCE(IDC_CATCHSCREEN));
// Main message loop:
while (GetMessage(&msg NULL 0 0))
{
if (!TranslateAccelerator(msg.hwnd hAccelTable &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
GdiplusShutdown(gdiplusToken);
::CoUninitialize();
return (int) msg.wParam;
}
HBITMAP CopyScreenToAlphaBitmap(int xint yint cxint cy )
{
HDC hScrDC hMemDC;
// 屏幕和内存设备描述表
HBITMAP hBitmap hOldBitmap;
// 位图句柄
hScrDC = ::GetDC(GetDesktopWindow());
//为屏幕设备描述表创建兼容的内存设备描述表
hMemDC = CreateCompatibleDC(hScrDC);
// 创建一个与屏幕设备描述表兼容的位图
hBitmap = CreateCompatibleBitmap(hScrDC cx cy);
//
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 51644 2011-10-21 11:45 CatchScreen\CatchScreen\CatchScreen.aps
文件 26084 2011-11-25 15:26 CatchScreen\CatchScreen\CatchScreen.cpp
文件 39 2011-10-20 14:17 CatchScreen\CatchScreen\CatchScreen.h
文件 23558 2003-07-23 17:52 CatchScreen\CatchScreen\CatchScreen.ico
文件 4046 2011-10-21 11:44 CatchScreen\CatchScreen\CatchScreen.rc
文件 4883 2011-10-20 17:01 CatchScreen\CatchScreen\CatchScreen.vcproj
文件 2205 2011-10-20 14:17 CatchScreen\CatchScreen\ReadMe.txt
文件 1177 2011-10-21 11:45 CatchScreen\CatchScreen\resource.h
文件 23558 2003-07-23 17:52 CatchScreen\CatchScreen\small.ico
文件 298 2011-10-20 14:17 CatchScreen\CatchScreen\stdafx.cpp
文件 669 2011-10-20 15:10 CatchScreen\CatchScreen\stdafx.h
文件 1428 2011-10-20 14:17 CatchScreen\CatchScreen\targetver.h
文件 899 2011-10-20 14:17 CatchScreen\CatchScreen.sln
..A..H. 25600 2011-11-25 15:29 CatchScreen\CatchScreen.suo
文件 133120 2011-11-25 15:26 CatchScreen\Debug\CatchScreen.exe
目录 0 2011-11-25 15:29 CatchScreen\CatchScreen
目录 0 2011-11-25 15:27 CatchScreen\Debug
目录 0 2011-11-25 15:29 CatchScreen
----------- --------- ---------- ----- ----
299208 18
- 上一篇:QT5.5 动态刷新tabview
- 下一篇:南邮离散数学实验全部源码
评论
共有 条评论