HBITMAP hCaptureBitmap = CopyScreenToBitmap(0, 1024,0, 768);
CBitmap* pBmp = CBitmap::FromHandle(hCaptureBitmap);
int Count;
BITMAP bm;
pBmp->GetObject(sizeof(bm),&bm);
Count = bm.bmWidthBytes * bm.bmHeight; //得到buf大小
BYTE *b=new BYTE[Count];
pBmp->GetBitmapBits(Count,b);
HDC hdc=::GetDC(m_hWnd);//
HDC mdc=CreateCompatibleDC(hdc);
HBITMAP MyBit=CreateCompatibleBitmap(hdc,1024,768);
SetBitmapBits(MyBit,Count,b);
SelectObject(mdc,MyBit);
BitBlt(hdc,0,0,1024,768,mdc,0,0,SRCCOPY);
::ReleaseDC(m_hWnd,hdc);
DeleteObject((HGDIOBJ)mdc);
delete [Count] b;
分享到:
相关推荐
VB旋转图像(位图),基于SetBitmapBits、GetBitmapBits函数来实现,这两个API函数操作BMP位图十分方便,本例围绕这两个函数进行BMP位图任意角度的旋转,其它图片格式也可以,但是容易失真,测试时最好是选择BMP图像...
GetBitmapBits和GetDIBits之间的区别
VB旋转图像(位图),基于SetBitmapBits、GetBitmapBits函数
利用VB内置的SetBitmapBits、GetBitmapBits两个API函数操作BMP位图进行旋转的一个实例,一定要载入BMP格式的位图,否则旋转过...
实现图像灰度变换,代码。用GetBitmapBits把位图颜色值写入内存中,然后把像素值一个个地读出来转换成灰度颜色,然后写到内存里,再用SetBitmapBits写到原来的那个位图句柄中,OK,灰度图转换完成。
函数原型:LONG SetBitmapBits(HBITMAP hmbp, DWORD cBytes, CONST VOID (lpBits); 参数: hbmp:指向要设置的位图的句柄? cBytes:指定参数lpBits指向的数组的字节数? lpBits:指向字节类型数组的...
dwValue = bitmap->GetBitmapBits(bitmapSize1, px); bgbmp->GetBitmap(&bmpY;); bitmapSize = bmpY.bmHeight * bmpY.bmWidthBytes; BYTE* px1=(BYTE *)GlobalAlloc(GPTR,bitmapSize); dwValue2 = bgbmp->...
由于使用了一些新的函数,本程序必须在Windows2000下运行。 Option Explicit Public Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As ...
GetBitmapBits MyBmp1, BmpSize, dat(0) ReDim Preserve dat(BmpSize + 1) dat(BmpSize) = 13 dat(BmpSize + 1) = 10 StartT = Timer On Error GoTo 400 'MsgBox UBound(dat) Ws2.SendData dat Exit ...
函数原型:LONG GetBitmapBits(HBITMAP hbmp, LONG cbBuffer, LPVOID lpvBits); 参数: hbmp:指向感兴趣的位图的句柄? cbBuffer:指定要从位图拷贝到缓冲区的字节数? lpvBits:指向接收位图位数据的缓冲...
WNetGetUniversalName 获取网络中一个文件的远程名称以及/或者UNC(统一命名规范)名称 WNetGetUser 获取一个网络资源用以连接的名字 WNetOpenEnum 启动对网络资源进行枚举的过程 2. API之消息函数 ...
// MyPaintView.cpp : implementation of the CMyPaintView class // #include "stdafx.h" #include "MyPaint.h" #include "Mainfrm.h" #include "MyPaintDoc.h" #include "MyPaintView.h" #include "MyImage.h" ...
stdafx.h的代码// This is a part of the Microsoft Foundation Classes C++ library. ...// All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes ...