Masked Blitting of 232-bit BMP images.

Win32 Programming


  • 1. Remove window's icon from the tasklist
    In my application I need to remove some window's icon from the tasklist (shown with ALT+TAB/ALT+SHIFT+TAB). I know two ways but both have their disadvantages: 1. Set WS_EX_TOOLWINDOW style for the window. The problem with this approach is that this style also affects the window decorations. 2. Disable window. In general, this works fine for me, however there is a problem here too. Consider the following scenario. I show the file dialog (with GetOpenFileName) and have all other windows disabled to remove their icons from the tasklist. Then the dialog is closed and I want some of my windows to be activated, but none is. I'm re-enabling all of them in WM_DESTROY handler for the file dialog. One more note: the file dialog has no owner, this is a key requirement (that's why I need to disable all the windows myself).
  • 2. GDI+ 1.1
    Hi! I'm calling GDI+ 1.1 flat functions from Delphi 7 and have some problems. I'm trying to convert EMF files to EMFplus so I can draw them with antialiasing and rasterize. They are all pieces of vector map. gdiplus.dll is version 1.1 from Office 2003 beta 2. GdipConvertToEmfPlus often returns Abort status. On the first maschine always same images fail to convert, but on second maschine other group of images fail. Tryed with GdipGraphicsSetAbort but can't understand how to declare GdiplusAbort structure descedant in Delphi. Is there any C++ example? Should I set Abort callback on image or on graphics and would it help in this case if Abort callback returns S_OK? Please help! Thanks!
  • 3. Do most Windows printer drivers leak memory
    We have a component product which creates drawings based on printer drivers. It calls CreateDC/DeleteDC many times. Recently we got a complain about memory leak. We examined the code and could not locate any. Finally we found that Windows printer drivers might be the source of issue, so we wrote a small console program (code below): #include "windows.h" int _tmain(int argc, _TCHAR* argv[]) { for(int i=0; i<10000; i++) { TCHAR PrinterName[64]; DWORD Size=64; ::GetDefaultPrinter(PrinterName, &Size); HDC hDC = CreateDC(NULL, PrinterName, NULL, NULL); printf("%d \t", i); ::LineTo(hDC, 100, 100); ::DeleteDC(hDC); } return 0; } We let it run and starts PerfMon to monitor Process/Private Byte change. We tested on many printer drivers. all except one have memory leak. The only one which does not leak memory is "Microsoft Fax". Some drivers leak 10K per loop. Is there any solution to this problem?

Masked Blitting of 232-bit BMP images.

Postby Varun Singh » Tue, 24 Aug 2004 19:23:05 GMT

     I am loading up a 32-bit BMP image using one HBITMP for the color data
and another for the Mask. I am calculating the mask during load-time by
checking the high-byte of the dword value. If it is lesser than 127, I am
setting the pixel in the monochrome mask to RGB(0,0,0) and if it is greater
I am setting it to RGB(255,255,255).
 The mask does seem to get created correctly, but when I use MaskBlt(), the
area to be drawn seems to be as the background. What I mean is that the
background raster OP seems to be affecting the image drawn .. Isn't there
any RASTER NOP which can be used? This is the call I am using to draw the
bitmap :-

      MaskBlt(m_backDC, bX, bY,
              winBmp->width(), winBmp->height(),
              0, 0,
              0, 0,

The source image is a red circle (non-masked area). The final blit shows a
black circle for the same area!

Can you please guide me as to what could be going wrong? Any hints, tips,
suggestions would be appreciated.


Re: Masked Blitting of 232-bit BMP images.

Postby vipin » Tue, 24 Aug 2004 20:03:10 GMT

Not sure exactly the problem:-

try this:- MAKEROP4(SRCCOPY , 00AA0029) or



Re: Masked Blitting of 232-bit BMP images.

Postby Varun Singh » Wed, 25 Aug 2004 20:55:00 GMT

Hi Vipin,
               The first version worked perfectly. Thanks a lot! 32-bit BMPs
have a pretty weird format and I think I was reading them wrong. I shifted
to 32-bit TGAs and all worked fine but only with your raster OP code. What
does it  mean btw?


Re: Masked Blitting of 232-bit BMP images.

Postby vipin » Wed, 25 Aug 2004 21:33:02 GMT

00AA0029  is the rop code for D(Destination).

It says in the areas where there is 1 in the mononchrome mask,
don't overwrite the destination,meaning don't touch the destination pixels
corresponding to those pixels.



Re: Masked Blitting of 232-bit BMP images.

Postby Varun Singh » Wed, 25 Aug 2004 21:59:01 GMT

Ok, thats what I needed I guess. A Background Raster NOP. :)

Is there any place where we can get all the code combinations or a
description of the format? Because in the header files (gdi.h) I can only
see a few combinations.


Re: Masked Blitting of 232-bit BMP images.

Postby vipin » Wed, 25 Aug 2004 22:49:39 GMT



Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 62 guest