title: Programatically setting a PNG to a Picture Control in Win32 APIs
body: <p>I use Visual Studio 2008, I have the PNG file loaded in the Resource View, assigned it IDB_BANG_PNG.</p>
  
  <p>The Picture Control is called IDC_STATIC15.</p>
  
  <p>I am having trouble trying to get the PNG loaded into the picture control.</p>
  
  <pre><code>LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  {
  
  // Way of loading a bmp with a mask perhaps?  Or a PNG file programatically?
  
  static HBRUSH hBrushStatic;
  HBITMAP hBmp = LoadBitmap(hDlg,MAKEINTRESOURCE(IDB_BANG_PNG));
  
  switch(message)
  {
  case WM_INITDIALOG:     
      CheckDlgButton(hDlg, IDC_CHECK, FALSE);
      EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
      // Bitmap version is IDB_BANG, PNG is at IDB_BANG_PNG
      // IDC_STATIC15 is the picture frame
      HWND item = GetDlgItem(hDlg,IDC_STATIC15);
      SendMessage(item,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBmp);   
      return TRUE;
  
  // .... snip
  </code></pre>
  
  <p>I am rather naive when it comes to Win32/GUI development, doing a quick project and got stuck her, any help is appreciated.</p>