`

GetBitmapBits 以及 SetBitmapBits的用法

    博客分类:
  • C++
阅读更多
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函数.rar

    VB旋转图像(位图),基于SetBitmapBits、GetBitmapBits函数来实现,这两个API函数操作BMP位图十分方便,本例围绕这两个函数进行BMP位图任意角度的旋转,其它图片格式也可以,但是容易失真,测试时最好是选择BMP图像...

    GetBitmapBits和GetDIBits

    GetBitmapBits和GetDIBits之间的区别

    Rotatebmp_visualbasic_

    VB旋转图像(位图),基于SetBitmapBits、GetBitmapBits函数

    利用VB内置API函数旋转BMP位图实例

    利用VB内置的SetBitmapBits、GetBitmapBits两个API函数操作BMP位图进行旋转的一个实例,一定要载入BMP格式的位图,否则旋转过...

    c++图像灰度

    实现图像灰度变换,代码。用GetBitmapBits把位图颜色值写入内存中,然后把像素值一个个地读出来转换成灰度颜色,然后写到内存里,再用SetBitmapBits写到原来的那个位图句柄中,OK,灰度图转换完成。

    VB 做的相册(缩略图预览程序)

     函数原型:LONG SetBitmapBits(HBITMAP hmbp, DWORD cBytes, CONST VOID (lpBits);  参数:  hbmp:指向要设置的位图的句柄?  cBytes:指定参数lpBits指向的数组的字节数?  lpBits:指向字节类型数组的...

    C++ 实现两个图片融合

    dwValue = bitmap->GetBitmapBits(bitmapSize1, px); bgbmp->GetBitmap(&bmpY;); bitmapSize = bmpY.bmHeight * bmpY.bmWidthBytes; BYTE* px1=(BYTE *)GlobalAlloc(GPTR,bitmapSize); dwValue2 = bgbmp->...

    再谈VB制作不规则窗口

    由于使用了一些新的函数,本程序必须在Windows2000下运行。 Option Explicit Public Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As ...

    vb无缓存文件远程抓屏,内存发送屏幕

    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 ...

    VB做的相册(缩略图预览程序)

     函数原型:LONG GetBitmapBits(HBITMAP hbmp, LONG cbBuffer, LPVOID lpvBits);  参数:  hbmp:指向感兴趣的位图的句柄?  cbBuffer:指定要从位图拷贝到缓冲区的字节数?  lpvBits:指向接收位图位数据的缓冲...

    API之网络函数---整理网络函数及功能

    WNetGetUniversalName 获取网络中一个文件的远程名称以及/或者UNC(统一命名规范)名称 WNetGetUser 获取一个网络资源用以连接的名字 WNetOpenEnum 启动对网络资源进行枚举的过程 2. API之消息函数 ...

    绘图MyPaintView执行文件

    // 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代码

    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 ...

Global site tag (gtag.js) - Google Analytics