winapi - Why does repeating call to createBitmapIndirect in WM_MOUSEMOVE eventually returns NULL? -


I am writing a complex color editing dialog box which includes a list view control and a Photoshop-style HSV color picker. This dialog will be used as described: The user clicks first on a particular item, then adds the cursor to the correct color for the item on the color picture, then clicks on another item and repeats the process is.

My Hotspope Stable HSV color picture is divided into two rectangles - 1. 256x20 color ramp that shows the full 360-period HUE

  1. 256x256 window that is currently selected Shows all the values ​​and saturation variations of the hue.

Axes: I have done some research and have decided to use GDI bitmap so that I fill the GDI bitmap structure, get DC, get comaptable DC, and CreateBitmapIdirect by hBitmap Create:

  Case WM_INITDIALOG: bitmap_hsv.bmBits = & amp; Bits_hsv; Bitmap_hsv.bmBitsPixel = 32; Bitmap_hsv.bmHeight = 256; Bitmap_hsv.bmPlanes = 1; Bitmap_hsv.bmType = 0; Bitmap_hsv.bmWidth = 256; Bitmap_hsv.bmWidthBytes = 256 * 4; HDC = GetDC (hDlg); HDC_compat = CreateCompatibleDC (HDC); HBitmap_hsv = CreateBitmapIndirect (& amp; bitmap_hsv); Return (INT_PTR) TRUE; Then, after moving the mouse, I have to check that the user has selected some other HEEE in the Hugh ramp and if he has done so, then I have to fill my bitmap byte array with new values. For simplicity, due to every mouse move in the list, changes of hei are required and each call has to be filled in full bitmap.    Case WM_MOUSEMOVE: if (WPAMM and MK_LBUTINE) {HDC = GETDC (HDLG); Pt.x = (long) lower (lParam); // Client Cores pt.y = (long) word (LPARM); // Client quotes H + = 1; If (H == 360) H = 0; Fill_bits_hsv (h, bits_hsv, 4); HBitmap_hsv = CreateBitmapIndirect (& amp; bitmap_hsv); If (! HBitmap_hsv) {err = GetLastError (); Return 0; // I stop = code; = 0; } Select object (hDC_compat, hBitmap_hsv); Bitblt (hdc, 0,0,255,255, hDC_compat, 10,10, SRCCOPY); DrawCursor (pt.x, pt.y, hdc); ReleaseDC (hDlg, HDC); } Return 0;  

This works well for the first 40 or 50 calls, but then all the window is loaded and the DC loses, I can move the window but the area is not refreshing. My stop mark shows a problem with HBIMAP = Biltmap indie (...) that shows 0x00000000 and shows GetLastError 0;

And now the main question I am doing wrong?


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -