코드
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();
}