save the bmp into IStream, then you can get HGLOBAL from the IStream. The
following is a clue
void savebmp(CBitmap& bmp)
{
CPictureHolder picture;
picture.CreateFromBitmap((HBITMAP)bmp, NULL, TRUE);
LPPICTUREDISP pPictureDisp=picture.GetPictureDispatch();
pPictureDisp->Release(); // must be released
IStorage* pStg = 0;
hr = ::StgCreateDocfile(L"c:\\picttest",
STGM_SHARE_EXCLUSIVE |
STGM_CREATE |
STGM_READWRITE,
0, &pStg);
if(SUCCEEDED(hr))
{
IStream* pStream = 0;
hr = pStg->CreateStream(L"PICTURE",
STGM_SHARE_EXCLUSIVE |
STGM_CREATE |
STGM_READWRITE,
0, 0, &pStream);
if(SUCCEEDED(hr))
{
hr = pPictureDisp->SaveAsFile(pStream,
TRUE, // save mem copy
NULL);
pStream->Release();
}
pStg->Release();
}
pPictureDisp->Release();
}
"Mvmelle" <mv*****@yahoo.com> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
This, got me going.
Now sending a HBITMAP trough an open socket is another problem.
"William DePalo [MVP VC++ ]" <wi***********@mvps.org> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl... "Mvmelle" <mv*****@yahoo.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl... I want to capture the entire screen as a bitmap (so I can stream it as an http GET).
This may help:
http://support.microsoft.com/?id=97193
But I fail to capture it.
I tried some samples I found on the internet, but without success.
Very nearly all of the WIN32 API's that can fail return an error code or
set the last error value in the calling thread. When you are having trouble
it is often a good idea to describe a little about the solutions you have
tried and how they have failed.
That said, though, the GDI group is probably better suited to your
question than this one.
Regards,
Will