Click here to Skip to main content
16,007,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing Arguments Pin
Chris Losinger4-Oct-01 8:19
professionalChris Losinger4-Oct-01 8:19 
GeneralPulling info from other apps Pin
RobJones4-Oct-01 7:21
RobJones4-Oct-01 7:21 
GeneralRe: Pulling info from other apps Pin
#realJSOP4-Oct-01 8:21
professional#realJSOP4-Oct-01 8:21 
GeneralRe: Pulling info from other apps Pin
RobJones4-Oct-01 11:22
RobJones4-Oct-01 11:22 
GeneralGrid probs Pin
Jon Hulatt4-Oct-01 7:03
Jon Hulatt4-Oct-01 7:03 
GeneralRe: Grid probs Pin
Christian Graus4-Oct-01 11:54
protectorChristian Graus4-Oct-01 11:54 
GeneralRe: Grid probs Pin
Jon Hulatt4-Oct-01 22:20
Jon Hulatt4-Oct-01 22:20 
GeneralBitmap and clipboard Pin
#realJSOP4-Oct-01 6:44
professional#realJSOP4-Oct-01 6:44 
I'm capturing a frame from a video stream. The data is being captured (I've verified that) as a 24-bit image. Part of the data being "captured" is the contents of the BITMAPINFOHEADER struct (again, this struct contains viable data).

I want to take this image and store it to the clipboard as a DIB.

Why doesn't this code work?

BITMAPINFO bmi;
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader = cb.bih; // the cb struct is populated by the capture callback

HDC hMemDC = CreateCompatibleDC(NULL);
HBITMAP hBitmap = CreateDIBitmap(hMemDC, &bmi.bmiHeader, CBM_INIT, cb.pBuffer, &bmi, DIB_RGB_COLORS);

if (OpenClipboard(NULL))
{
   EmptyClipboard();
   if (!SetClipboardData(CF_DIB, hBitmap))
   {
      // show error message
   }
   CloseClipboard();
}


It always says that the hBitmap handle is invalid when I try to call SetClipboardData(). The hBitmap isn't NULL.
GeneralRe: Bitmap and clipboard Pin
Chris Losinger4-Oct-01 7:00
professionalChris Losinger4-Oct-01 7:00 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 7:18
professional#realJSOP4-Oct-01 7:18 
GeneralRe: Bitmap and clipboard Pin
Chris Losinger4-Oct-01 7:29
professionalChris Losinger4-Oct-01 7:29 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 7:57
professional#realJSOP4-Oct-01 7:57 
GeneralRe: Bitmap and clipboard Pin
Chris Losinger4-Oct-01 7:59
professionalChris Losinger4-Oct-01 7:59 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 8:19
professional#realJSOP4-Oct-01 8:19 
GeneralRe: Bitmap and clipboard Pin
Chris Losinger4-Oct-01 8:23
professionalChris Losinger4-Oct-01 8:23 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 8:42
professional#realJSOP4-Oct-01 8:42 
GeneralRe: Bitmap and clipboard Pin
Chris Losinger4-Oct-01 8:45
professionalChris Losinger4-Oct-01 8:45 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 8:49
professional#realJSOP4-Oct-01 8:49 
GeneralRe: Bitmap and clipboard Pin
Tomasz Sowinski4-Oct-01 7:10
Tomasz Sowinski4-Oct-01 7:10 
GeneralRe: Bitmap and clipboard Pin
#realJSOP4-Oct-01 7:16
professional#realJSOP4-Oct-01 7:16 
GeneralRe: Bitmap and clipboard Pin
Tomasz Sowinski4-Oct-01 7:17
Tomasz Sowinski4-Oct-01 7:17 
QuestionMCI CD Audio Mount and Eject? Pin
Bryan Anslow4-Oct-01 6:10
Bryan Anslow4-Oct-01 6:10 
AnswerRe: MCI CD Audio Mount and Eject? Pin
Tomasz Sowinski4-Oct-01 6:24
Tomasz Sowinski4-Oct-01 6:24 
GeneralRe: MCI CD Audio Mount and Eject? Pin
Bryan Anslow9-Oct-01 3:35
Bryan Anslow9-Oct-01 3:35 
QuestionAgain: Are there any methods to construct a CFtpConnection object from a HINTERNET handle? Pin
Chaos Lawful4-Oct-01 5:20
Chaos Lawful4-Oct-01 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.