Settings | Sign in | Sign up

There is currently 1 post.

要查看一個HBITMAP的內容,最快速的方法是將其複製到剪切板

Floor 1 巨大八爪鱼 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);
}

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.