   Really frustrated...
  Can someone tell me where the heck this code is going wrong.  I have some memory with 8 bit values that I want do display in a picture control.  IDC_DISPLAY is a picture box set to type Rectangle (although changing it to other types doesn't help).Globally I declare these variables and initialize them as follows:CWnd *Display;CDC *dispDC;Display = new CWnd();Display = GetDlgItem(IDC_DISPLAY);dispDC = new CDC();dispDC = Display->GetWindowDC();Then when a timer goes off I want to take the values in this temp buffer that have been filled in and display them.  Here is what I do:CDC memDC;CBitmap bm;DWORD dwVal;memDC.CreateCompatibleDC(dispDC);//dwVal = bm.CreateBitmap(width, height, 1, 8, temp);//dwVal = bm.SetBitmapBits(width*height, temp);//bm.LoadBitmapA(IDB_BITMAP1);memDC.SelectObject(bm);dispDC->BitBlt(0,0,width, height, &memDC, 0,0,SRCCOPY);Using LoadBitmapA() works fine with predefined bitmap, but SetBitmapBits() returns an error saying it has an invalid handle and CreateBitmap() returns success but the display is blank.  Can anyone tell me1) Why this doesn't work2) What the best way to do what I'm trying to do isThe 8 bit values are grayscale so I'm assuming I have to set up a color palette but I can't even get the stupid basic stuff to work.Thanks,Andrew   
  Ok here's some more info.  I originally thought the temp array could just have the same number of bytes as pixels in my image, but is this correct?  Do I have to have 3x the number of pixels for the RGB information?When I calldwVal = bm.CreateBitmap(width, height, 1, 8, temp);thenbm.GetBitmap() everything looks ok except the bmBits pointer which is NULL