Questions tagged [hbitmap]

A handle to a bitmap (one of Windows Data Types)

HBITMAP is pointer to any type. But usually it is used for pointing on BITMAP object (one of Windows Data Types). See it's declaration:

typedef HANDLE HBITMAP; // see WinDef.h
typedef PVOID HANDLE;   // see WinNT.h
typedef void *PVOID;    // see WinNT.h
96 questions
3
votes
1 answer

HBITMAP adding transparency / alpha channel

I'm trying to add transparency to a hbitmap object but it never draw anything :/ this is the code i use to draw the handle HDC hdcMem = CreateCompatibleDC(hDC); HBITMAP hbmOld = (HBITMAP) SelectObject(hdcMem, m_hBitmap); BLENDFUNCTION…
ColmanJ
  • 457
  • 2
  • 12
  • 28
3
votes
3 answers

Use native HBitmap in C# while preserving alpha channel/transparency

Let's say I get a HBITMAP object/handle from a native Windows function. I can convert it to a managed bitmap using Bitmap.FromHbitmap(nativeHBitmap), but if the native image has transparency information (alpha channel), it is lost by this…
TechAurelian
  • 5,561
  • 5
  • 50
  • 65
3
votes
1 answer

Sometimes bitmaps are upside down when getting file thumbnails

I use this method to get thumbnails of files (keeping transparency...): public static Image GetIcon(string fileName, int size) { IShellItem shellItem; Shell32.SHCreateItemFromParsingName(fileName, IntPtr.Zero, Shell32.IShellItem_GUID, out…
Mart
  • 512
  • 5
  • 13
3
votes
1 answer

How can i free hbitmap

Hello i have the following function which i use afterwards from c# to display a bitmap with "Bitmap.FromHbitmap(IntPtr)" but after a few usages this ends with a memory leak . IntPtr GetFrame(int Width,int Height,int nFrame) { width=…
adi sba
  • 621
  • 1
  • 12
  • 32
3
votes
1 answer

Getting HBITMAP from layered window - incorrect data

I created a layered window (with WS_EX_LAYERED), size of about 400X300 px. When drawing the window (using UpdateLayeredWindow) everything works great. The problem is that I'm unable to get the HBITMAP of the window after drawing it. When trying to…
Bagelzone Ha'bonè
  • 1,192
  • 1
  • 14
  • 29
3
votes
1 answer

Draw HBITMAP onto layered window. What's wrong?

Hello and good day to everyone, my final target is to draw a PNG file including alpha onto the screen - that means not into an own window but just somewhere on the desktop. The part to load PNG's into a HBITMAP works now (tested that in a diffrent…
DragonGamer
  • 834
  • 3
  • 9
  • 27
2
votes
1 answer

Reset existing HBITMAP as desktop background (Win32)

I wish to create a transparent window over the desktop. For that purpose I've created an HDC with a background of the desktop (created HBITMAP of the desktop and applied it to my HDC), and invoked UpdateLayeredWindow. So far, so good. for…
Bagelzone Ha'bonè
  • 1,192
  • 1
  • 14
  • 29
2
votes
1 answer

Displaying HBITMAP

I apologize upfront; I'm new to c and I really don't know what I'm doing. I am trying to capture and display a screen shot using Windows 7 and c. I know it sounds dumb, eventually I will need each of these functions in different programs, the one…
Matt_Bro
  • 14,062
  • 2
  • 28
  • 41
2
votes
0 answers

Unable to figure out problem with BitBlt in win32

I am new to windows programming and stuck with legacy code of software and having difficulty in figuring out the cause. The problem at hand is I have a SourceHDC and I am dumping it onto ScreenDC(HWND) and to memory DC. The screenDC behaves…
Illuminati
  • 111
  • 7
2
votes
1 answer

Images not printing after the latest security update

My application fails to print after the latest security update. None of the API calls fail, yet the images don't show even in PDF. Text and shapes like lines print fine. The code loads a JPG image using IPicture interface and OleLoadPicture(). Then…
IgorD
  • 155
  • 1
  • 8
2
votes
0 answers

HBITMAP StretchBlt caused image saturation

I used the following code to resize win32 HBITMAP. HBITMAP ResizeBitmap(HDC hDC, HBITMAP source) { HDC hMemDC2 = CreateCompatibleDC(hDC); HGDIOBJ hOld2 = SelectObject(hMemDC2, source); BITMAP bitmap = { 0 }; GetObject(hBitmap,…
fireman
  • 193
  • 8
2
votes
1 answer

Couldn't create HBITMAP from glReadpixels

So here's a part of my code, what I'm trying to do is to make a HBITMAP from a OpenGl frame capture. unsigned char *output = 0; output = new unsigned char[WINDOW_WIDTH * WINDOW_HEIGHT * 3]; glReadPixels(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, GL_RGB,…
anako
  • 125
  • 7
2
votes
2 answers

How to use GetHBITMAP method?

I have a gdi+ bitmap, and I want to convert bitmap into HBitmap. I write the following code. HBITMAP temp; Color color; img->GetHBITMAP(color, &temp); But It do not work, How can I get a HBitmap?
user25749
  • 4,825
  • 14
  • 61
  • 83
2
votes
0 answers

retrieve window screenshot / capture

I have a remote application that the a screenshot using "windows handle". ( I mean HDC, HBITMAP, ....). The code look like this : int nScreenWidth = GetSystemMetrics(SM_CXSCREEN); int nScreenHeight = GetSystemMetrics(SM_CYSCREEN); HDC hDesktopDC =…
Monero Jeanniton
  • 441
  • 8
  • 20
2
votes
2 answers

HBITMAP to JPEG /PNG without CImage in C++

I've got a HBITMAP that I want to save into a JPEG/PNG stream or array of bytes. The problem is that I'm using mingw as my compiler so I can't use CImage.. which would have made my life easier. I can get the pixels from the bitmap without any…
Michael
  • 930
  • 5
  • 8