WebBrowser-Capture

2008. 8. 14. 17:54코드


    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();