본문 바로가기
코드

IID_IViewObject::Draw

by umaking 2008. 7. 21.

void __fastcall TForm1::Button3Click(TObject *Sender) 
{ 
     HRESULT hr; 

    IViewObject *ViewObject; 
    hr=CppWebBrowser1->Document->QueryInterface(IID_IViewObject,(void **)&ViewObject); 
   // hr=CppWebBrowser1->DefaultDispatch->QueryInterface(IID_IViewObject,(void **)&ViewObject); 
    //Document 나 DefaultDispatch  둘다 됩니다. 

     if (SUCCEEDED(hr)) 
     { 
        TRect rc=Rect(0,0,CppWebBrowser1->Width, CppWebBrowser1->Height); 
        Image1->Picture->Bitmap->Width=CppWebBrowser1->Width ; 
        Image1->Picture->Bitmap->Height=CppWebBrowser1->Height; 
        OleCheck(ViewObject->Draw(DVASPECT_CONTENT, 1, NULL, NULL, Form1->Handle, Image1->Picture->Bitmap->Canvas->Handle,(const _RECTL *)&rc, NULL,NULL, 0)); 
        Image1->Repaint(); 
     } 
}