본문 바로가기
코드

WebBrowser-Capture

by umaking 2008. 8. 14.

    IViewObject2 *vObj ;
    TRect rect = Rect(0, 0, CppWebBrowser1->Width, CppWebBrowser1->Height);
    Graphics::TBitmap *bmp = new Graphics::TBitmap();

    bmp->Width = CppWebBrowser1->Width;
    bmp->Height = CppWebBrowser1->Height;

    if(FAILED(CppWebBrowser1->Document->QueryInterface(IID_IViewObject2, (void **)&vObj)))
        return;

    OleCheck(vObj->Draw(DVASPECT_CONTENT, 1, NULL, NULL, this->Handle,
                 bmp->Canvas->Handle,
                 (const _RECTL *)&rect, NULL, NULL, 0));
    Image1->Picture->Bitmap->Assign(bmp);
    
    vObj->Release();