There is currently 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
1180 0
要查看一个HBITMAP的内容,最快速的方法是将其复制到剪切板
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 6/24/16 13:39
#include <stdio.h>
#include <Windows.h>

int main(void)
{
    HBITMAP hbmp;
    HDC hdc, hdcMem;

    hdc = GetDC(NULL);
    hbmp = CreateCompatibleBitmap(hdc, 300, 250);
    hdcMem = CreateCompatibleDC(hdc);
    SelectObject(hdcMem, hbmp);

    BitBlt(hdcMem, 0, 0, 300, 250, hdc, 800, 600, SRCCOPY);
    
    DeleteDC(hdcMem);
    //DeleteObject(hbmp);

    OpenClipboard(NULL);
    EmptyClipboard();
    SetClipboardData(CF_BITMAP, hbmp);
    CloseClipboard();

    ReleaseDC(NULL, hdc);
}
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 1180 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 6/24/16 13:39
Bar Good Posts
Announcements