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
1
vote
2 answers

LoadBitmap fails after multiple calls

In this function, after about 90 calls (it's called in a loop and the idea is to load in a separate image each time, but I have kept it to one image for simplicity).The global variables now changed to local ones. void…
1
vote
0 answers

GetDIBits is failing. It returns only zero values for pixels

I have looked for GetDIBits all over and only seem to find discussion in every other application other than Excel 2016. I keep getting back 0 for all of the pixel values. I don't know if using Image1.Picture.Handle is the proper statement for the…
1
vote
1 answer

Strange problem about conversion between GDI+ to GDI: Bitmap and HBitmap

I want to convert gdi+ Bitmap into gdi object HBitmap. I am using the following method: Bitmap* img = new Bitmap(XXX); // lots of codes... HBITMAP temp; Color color; img->GetHBITMAP(color, &temp); the img object is…
user25749
  • 4,825
  • 14
  • 61
  • 83
1
vote
1 answer

Convert vector to HBITMAP in C++

I have used the code here to load a PNG image into a BMP raw vector std::vector . Now, I need to apply this image as background to a WinAPI window and I don't know how could I convert it to HBITMAP. Maybe somebody did it before or…
ali
  • 10,927
  • 20
  • 89
  • 138
1
vote
2 answers

How to change the toolbar button's Bitmap in win32?

I have created a toolbar with some controls on it using ReBar within a window. Can anyone please tell me, How to get the HWND of a buttons/combobox/etc (not normal buttons in a window) if I know (only) the Id of it ? How to obtain the HBITMAP if…
Morpheus
  • 1,722
  • 5
  • 27
  • 38
1
vote
0 answers

How to convert/make HBITMAP to string C++

EDIT: connection - socket connection I'm working on stuff that require me to send HBITMAP through the connection, as known the sending is sending strings. How can I make HBITMAP to string to send OR is there any other way to transfer the HBITMAP?
Ofek .T.
  • 741
  • 3
  • 10
  • 29
1
vote
1 answer

How can I set pixel data storage for BITMAP

I have a following problem. Somewhere I have defined array for storing pixels of my bitmap. unsigned int table[512*512]; I would like this array to be used as data. I've found CreateBitmap(), but it does not behave in desired way. Instead of…
user2768609
  • 23
  • 1
  • 4
1
vote
2 answers

Getting EZTwain BARCODE_Recognize return value of -4

I'm trying to use the EZTwain scanning library to retrieve barcodes from a scanned image, and I'm getting a return value of -4 when I try to call EZTwain.BARCODE_Recognize(IntPtr, int, int), which there is no description for in the EZTwain user…
Zack
  • 2,789
  • 33
  • 60
1
vote
1 answer

Create a Bitmap (.NET) from HBITMAP

I'm using C++/CLI and I have a raw HBITMAP called hStrip, I have to display this in a PictureBox, so I found the following function System::Drawing::Image::FromHbitmap, however this takes IntPtr and I wondered if I need to convert my raw HBITMAP to…
Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
0
votes
1 answer

Getting HBitmap from IGraphBuilder

I'm trying to encode a video from an IGraphBuilder, for this I would require a HBitmap is it possible for me to do this? P.S. I know that IGraphBuilder already has a RenderFile function, however this is too slow for my use and I would also prefer to…
kiwijus
  • 1,217
  • 1
  • 20
  • 40
0
votes
1 answer

Should I always replace default object after it has finished work with the new object when I Use DC

I just use a temp DC created with: ::CreateCompatibleDC(NULL); Then I draw some image to this temp DC. I want to get the image in this DC, so I use CreateCompatibleBitmap() to create a temp bitmap and use SelectObject() to get the original HBITMAP…
0
votes
3 answers

HBITMAP memory leak

No matter how hard I looked and whatever I tried, I couldn't find why this code is leaking. Actually, I'm not sure about the leak but the number of GDI objects increases everytime I use this piece of code. HBITMAP hBmp; hBmp = CreateDIBitmap(dc,…
0
votes
2 answers

GDI C/C++ - BITMAP into an existing HBITMAP

How can I create a device context compatible bitmap and then associating the obtained handle to a BITMAP struct? If I write: ... HBITMAP hbitmap = CreateCompatibleBitmap(hdc, width, height); // these three arguments are initialized somewhere…
Stencil
  • 1,833
  • 1
  • 17
  • 19
0
votes
1 answer

Read pixels (raw bytes) from an hbitmap without copying?

I have an HBITMAP handle to a device-dependent bitmap, resulting from this code: // copy screen to bitmap HDC hScreen = GetDC(NULL);//don't use hwnd, it doesn't work for non native windows HDC hDC = CreateCompatibleDC(hScreen); HBITMAP…
Dartz
  • 11
  • 4
0
votes
1 answer

Can't release HBITMAP, memory leaking using CreateDIBitmap

I am using CreateDIBitmap() and always realeasing it by DeleteObject(). I am using it when my slider is moving and I noticed that memory used is increasing every time. This is my function that creating HBITMAP from indexed bitmap data: HBITMAP…
Mateusz
  • 119
  • 10