资源简介
测试见http://blog.csdn.net/u011668104/article/details/53162845 第3部分运行测试与调整
代码中FillBuff函数是具体写图片数据的,大家一般都是改这里。
之前这个资源我传错代码了,之前的代码QQ会奔溃,这个没有问题,有问题找我huqiaoping23@qq.com
代码片段和文件信息
//------------------------------------------------------------------------------
// File: DibHelper.cpp
//
// Desc: DirectShow sample code - In-memory push mode source filter
// Helper routines for manipulating bitmaps.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include
#include “dibhelper.h“
HBITMAP CopyScreenToBitmap(LPRECT lpRect BYTE *pData BITMAPINFO *pHeader HCURSOR hCursor)
{
HDC hScrDC hMemDC; // screen DC and memory DC
HBITMAP hBitmap hOldBitmap; // handles to deice-dependent bitmaps
int nX nY nX2 nY2; // coordinates of rectangle to grab
int nWidth nHeight; // DIB width and height
int xScrn yScrn; // screen resolution
// check for an empty rectangle
if (IsRectEmpty(lpRect))
return NULL;
// create a DC for the screen and create
// a memory DC compatible to screen DC
hScrDC = CreateDC(TEXT(“DISPLAY“) NULL NULL NULL);
hMemDC = CreateCompatibleDC(hScrDC);
// get points of rectangle to grab
nX = lpRect->left;
nY = lpRect->top;
nX2 = lpRect->right;
nY2 = lpRect->bottom;
// get screen resolution
xScrn = GetDeviceCaps(hScrDC HORZRES);
yScrn = GetDeviceCaps(hScrDC VERTRES);
//make sure bitmap rectangle is visible
if (nX < 0)
nX = 0;
if (nY < 0)
nY = 0;
if (nX2 > xScrn)
nX2 = xScrn;
if (nY2 > yScrn)
nY2 = yScrn;
nWidth = nX2 - nX;
nHeight = nY2 - nY;
// create a bitmap compatible with the screen DC
hBitmap = CreateCompatibleBitmap(hScrDC nWidth nHeight);
// select new bitmap into memory DC
hOldBitmap = (HBITMAP) Selectobject(hMemDC hBitmap);
// bitblt screen DC to memory DC
BitBlt(hMemDC 0 0 nWidth nHeight hScrDC nX nY SRCCOPY);
// draw mouse
POINT pt;
GetCursorPos(&pt);
DrawIconEx(hMemDC pt.x-10 pt.y-10 hCursor 0 0 0 NULL DI_NORMAL);
// select old bitmap back into memory DC and get handle to
// bitmap of the screen
hBitmap = (HBITMAP) Selectobject(hMemDC hOldBitmap);
// Copy the bitmap data into the provided BYTE buffer
GetDIBits(hScrDC hBitmap 0 nHeight pData pHeader DIB_RGB_COLORS);
// clean up
DeleteDC(hScrDC);
DeleteDC(hMemDC);
// return handle to the bitmap
return hBitmap;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 32164 2016-11-24 18:26 VirtualCamera-FQQ\Debug\DibHelper.obj
文件 0 2016-11-24 18:26 VirtualCamera-FQQ\Debug\DibHelper.sbr
文件 60035 2016-11-24 18:26 VirtualCamera-FQQ\Debug\Dll.obj
文件 0 2016-11-24 18:26 VirtualCamera-FQQ\Debug\Dll.sbr
文件 141392 2016-11-24 18:26 VirtualCamera-FQQ\Debug\Filter.obj
文件 0 2016-11-24 18:26 VirtualCamera-FQQ\Debug\Filter.sbr
文件 920576 2016-11-24 18:26 VirtualCamera-FQQ\Debug\vc120.idb
文件 782336 2016-11-24 18:26 VirtualCamera-FQQ\Debug\vc120.pdb
文件 4781 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VCam.Build.CppClean.log
文件 1385 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VCam.exp
文件 1492 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VCam.lib
文件 6130688 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.bsc
文件 5563 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.log
文件 738 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\BscMake.command.1.tlog
文件 1254 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\bscmake.read.1.tlog
文件 742 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\bscmake.write.1.tlog
文件 2720 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\cl.command.1.tlog
文件 73058 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\CL.read.1.tlog
文件 3018 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\CL.write.1.tlog
文件 1584 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\li
文件 4170 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\li
文件 1042 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\li
文件 216 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\VirtualCamera.lastbuildstate
文件 552 2016-11-24 18:26 VirtualCamera-FQQ\Debug\VirtualCamera.tlog\VirtualCamera.write.1u.tlog
文件 2577 2009-02-19 16:18 VirtualCamera-FQQ\DibHelper.cpp
文件 1701 2009-02-19 14:43 VirtualCamera-FQQ\DibHelper.h
文件 586 2016-11-14 12:04 VirtualCamera-FQQ\directshow.props
文件 3656 2016-11-14 15:26 VirtualCamera-FQQ\Dll.cpp
文件 257 2009-02-19 11:04 VirtualCamera-FQQ\Dll.def
文件 1644 2014-09-16 23:38 VirtualCamera-FQQ\dshow\include\ba
............此处省略66个文件信息
- 上一篇:VC++ 推箱子游戏源代码(双缓存版)
- 下一篇:教学计划编制 C++ 数据结构
相关资源
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
- c++ 虚拟摄像头
- hook,捕获所有案件,查找所有窗口,
- C语言课设计算器
- c++ 简易贪吃蛇源码
- 高精度加法(c++代码)
- C++调用百度地图案例
- 北京化工大学计算方法(C/C++)讲义
- 基于VC++的SolidWorks二次开发SolidWorks
- c++ 模拟鼠标按键
- OFD编辑器
- Beginning C++17 From Novice to Professional
- C++ STL实现
- opencv手部轮廓识别以及轨迹识别
- 百度C++编码规范
- C++ sql2008 WebServer通讯.docx
- c++ 定时关机程序源码
- 基于VSCode和CMake实现C++开发
- c++语法查询工具
- c++ 账务系统源码
评论
共有 条评论