Explain, please. There are HWND windows. From it I receive dc: GetDC (hwnd). Now how can I create a context in memory that is compatible with the DC window, so that BITMAP is in memory context. And so I had a pointer to an array of pixels of this BITMAP. Do not write that in the internet a lot of information about this. She helped me a little.
HBITMAP hbmp; HDC windc; HDC memdc; int bits; ////////////// windc=GetDC(hwnd); memdc=CreateCompatibleDC(windc); hbmp=СreateBitmap(100,100,1,24,&bits); SelectObject(memdc,hbmp); SetPixel(memdc,1,1,RGB(255,255,0)); //////////////// WM_PAINT: BitBlt(GetDC(hwnd),0,0,100,100, memdc,0,0,SRCCOPY);`
Here, nothing happens. The window behaves alone as with this code, that without it. bits are pixels. As planned, changing them will change the picture in the window.