資源簡介
屏幕截圖 多屏 截窗口 十字放大 類似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
- 下一篇:南郵離散數學實驗全部源碼
評論
共有 條評論