title: How could I draw a RGB HBITMAP and display it in a STATIC WINDOW using C?
body: <pre><code>HBITMAP DisplayMap(HDC hThisDC){
      HDC hDC=CreateCompatibleDC(hThisDC);
  
      BITMAPINFOHEADER bi;
      bi.biSize=sizeof(BITMAPINFOHEADER);
      bi.biWidth=670;
      bi.biHeight=540;
      bi.biPlanes=1;
      bi.biBitCount=24;
      bi.biCompression=BI_RGB;
      int lineSize=((((bi.biWidth*bi.biBitCount)+31)&amp;~31)&gt;&gt;3);
      bi.biSizeImage=lineSize*bi.biHeight;
  
      unsigned char* data=(unsigned char*)malloc(bi.biSizeImage);
      int off=0;
      for(int y=0;y&lt;bi.biHeight;y++){
          for(int x=0;x&lt;bi.biWidth;x++){
              data[off+3*x]=255;
              data[off+3*x+1]=0;
              data[off+3*x+2]=127;
          }
          off+=lineSize;
      }
  
      HBITMAP hBitmap=CreateDIBitmap(hDC,&amp;bi,CBM_INIT,data,(BITMAPINFO*)&amp;bi,DIB_RGB_COLORS);
      SetDIBits(hDC,hBitmap,0,bi.biHeight,data,(BITMAPINFO*)&amp;bi,DIB_RGB_COLORS);
      return hBitmap;
  }
  
  //
  HBITMAP hBitmap=DisplayMap(GetDC(hwnd));
  if(hBitmap==NULL||true){
      char* str=(char*)malloc(15);
      sprintf(str,"ERROR: %d!",GetLastError());
      MessageBox(NULL,str,"ALERT",MB_OK|MB_ICONEXCLAMATION);
  }
  
  ShowWindow (hwnd, nFunsterStil);
  SendMessage(hFrame, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBitmap);
  //
  </code></pre>
  
  <p>If I use "(HBITMAP)LoadImage()" to display it, it shows no problem. But as I'm using my function "DisplayMap()" which is supposed to create a HBITMAP out of nothing it doesn't work. The script shows no erros and the "hBitmap" return a valid HBITMAP (not NULL), but don't matter the color I choose to fill the bitmap, it keeps displaying the same full-black image.</p>
  
  <p>I searched for a solution in Google through many sources and I wasn't able to figure out the problem. I thank for any help, has been a long time I don't work with c.The idea is to  create and display an image sequence which shall be generate just in time without loading anything from files.</p>