Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Delphi code..
- (WebBrowser1.Document as IHTMLDocument2).designMode := 'on';
- (WebBrowser.Document as IHTMLDocument2).body.innerHTML;
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #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<IHTMLDocument2>(&html);
- html->put_designMode(L"On");
- html->Release();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::btnInsertImageClick(TObject *Sender)
- {
- if (wb->Document)
- {
- IHTMLDocument2 *html;
- wb->Document->QueryInterface<IHTMLDocument2>(&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<IHTMLDocument2>(&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();
- }
- }
- //---------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment