in C++ Builder, it would be something like this:
(wb is a TCppWebBrowser)
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "mshtml.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnNavigateAndEditClick(TObject *Sender)
{
wb->Navigate((WideString)"www.google.com");
while (wb->Busy)
Application->ProcessMessages();
if (wb->Document)
{
IHTMLDocument2 *html;
wb->Document->QueryInterface(&html);
html->put_designMode(L"On");
html->Release();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnInsertImageClick(TObject *Sender)
{
if (wb->Document)
{
IHTMLDocument2 *html;
wb->Document->QueryInterface(&html);
VARIANT var;
VARIANT_BOOL receive;
html->execCommand(L"InsertImage",true,var, &receive);
html->Release();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnGetHtmlClick(TObject *Sender)
{
if (wb->Document)
{
IHTMLDocument2 *html;
wb->Document->QueryInterface(&html);
IHTMLElement *pElement;
html->get_body(&pElement);
pElement->get_parentElement(&pElement);
wchar_t *tmp;
pElement->get_outerHTML(&tmp);
Memo1->Lines->Text = tmp;
pElement->Release();
html->Release();
}
}
//---------------------------------------------------------------------------