title: bitmap transparency in Visual Studio 2013 C++
body: <p>I'm puzzled on this one.  I use a program recommended on the forums to convert 32bit PNG to 32bit bitmaps with alpha channel.  I add these to the resource editor and place them via the toolbox onto a Dialog.  I have read (what I thought was extensively) on bitmap transparency and the limitations in Visual Studio.<br>
  What's puzzling for me is that I add the picture control via the Visual Studio resource editor to my dialog box.  For example, I have two red balls, one in 24bit bitmap and one with 32bit bitmap.  In the test mode of visual studio and when opening the .rc with the resource editor the transparency looks fine.
  <img src="https://i.stack.imgur.com/qp1j2.png" alt="Test mode of visual studio"></p>
  
  <p>However, when I call DialogBox programmatically, I don't get transparency.</p>
  
  <pre><code>DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),
      NULL, DialogProc);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/iVJFN.png" alt="Dialog when DialogBox is called programmatically">
  When I click the test button in Visual Studio, it must be calling a routine DialogBox or similar to show the bitmap.  When I place the bitmap in the resource editor to the dialog it shows transparency.  What is it Microsoft does that I'm not doing?<br>
  I'm developing without MFC, intentionally.  Is that the issue, only in MFC can Dialogbox's be loaded with transparency (I realize it reduces to CreateWindowEX).
  I realize that various bitblt methods also can be used.  Is that what Visual Studio does behind the scenes?  Also reviewed material on WM_CTLCOLORSTATIC etc.
  What do you all think?  Is there some simple way to call DialogBox and get transparent BMPs on the dialog? Or we're all forced to use MFC? or the user has to write the routines to erase the background/paint etc.   </p>
  
  <p>It seems a bit odd to me that without an image with transparency, a dialogbox is easy.  Need a non-square image? That's somehow a problem. Now the software engineer has to add lots of code to the Dialog Callback or program.  Seems more of a bug to me.</p>
  
  <p>Thank you for your review.</p>
  
  <pre><code> #include &lt;windows.h&gt;
   #include &lt;winuser.h&gt;
   #include "resource.h"
  
  
   INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM   lParam)
    {
    int wmId, wmEvent;
  
    switch (message)
     {
     case WM_COMMAND:
      wmId = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId)
      {
      case IDOK:
          EndDialog(hwnd, LOWORD(wParam));
          break;
      case IDCANCEL:
          EndDialog(hwnd, LOWORD(wParam));
          return TRUE;
  
      }
  
  case WM_PAINT:
      break;
  
  case WM_DESTROY:
      EndDialog(hwnd, LOWORD(wParam));
      break;
  }
  return FALSE; 
  }
  
  
   int APIENTRY WinMain(HINSTANCE hInstance,
   HINSTANCE hPrevInstance,
   LPSTR     lpCmdLine,
   int       nCmdShow)
   {
  
  
  DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),
      NULL, DialogProc);
  
  return 0;
   }
  </code></pre>