본문 바로가기
코드

TShellWindows

by umaking 2008. 8. 19.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 TShellWindows *Sh = new TShellWindows(NULL);
 try
 {
  for(int i = 0; i < Sh->Count; i++)
  {
   if(Sh->Item(i) == NULL)
    continue;

   Draw(Sh->Item(i));
   break;
  }
 }
 __finally
 {
  delete Sh;
 }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Draw(IDispatch *Idisp)
{
 IWebBrowser2 *IE = (IWebBrowser2 *)NULL;
 IViewObject *vObj = (IViewObject *)NULL;
 int width, height;

 if(FAILED(Idisp->QueryInterface(IID_IWebBrowser2, (void **)&IE)))
  return;

 if(IE == NULL)
  return;

 if(FAILED(IE->Document->QueryInterface(IID_IViewObject, (void **)&vObj)))
  return;

 IE->Get_Width(width);
 IE->Get_Height(height);
 TRect rect = Rect(0, 0, width, height);


 vObj->Draw(DVASPECT_CONTENT, 1, NULL, NULL, IE,
   Image1->Canvas->Handle,(const _RECTL *)&rect,
   NULL,NULL, 0);

 Image1->Repaint();

 vObj->Release();
 IE->Release();
}

'코드' 카테고리의 다른 글

printStackTrace  (0) 2008.09.02
DoCapture(IHTMLElement *ele, IViewObject2 *vObj, int width, int height, int cwidth, int cheight, int wd, int hd)  (0) 2008.08.19
TInternetExplorer  (0) 2008.08.14
WebBrowser-Capture  (0) 2008.08.14
IID_IViewObject::Draw  (0) 2008.07.21