code_junkie

HTML Editor for CBuilder/Delphi

Nov 13th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. // Delphi code..
  2. (WebBrowser1.Document as IHTMLDocument2).designMode := 'on';
  3.  
  4. (WebBrowser.Document as IHTMLDocument2).body.innerHTML;
  5.  
  6. //---------------------------------------------------------------------------
  7.  
  8. #include <vcl.h>
  9. #pragma hdrstop
  10. #include "mshtml.h"
  11.  
  12. #include "Unit1.h"
  13. //---------------------------------------------------------------------------
  14. #pragma package(smart_init)
  15. #pragma link "SHDocVw_OCX"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. //---------------------------------------------------------------------------
  19. __fastcall TForm1::TForm1(TComponent* Owner)
  20. : TForm(Owner)
  21. {
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::btnNavigateAndEditClick(TObject *Sender)
  25. {
  26. wb->Navigate((WideString)"www.google.com");
  27. while (wb->Busy)
  28. Application->ProcessMessages();
  29.  
  30. if (wb->Document)
  31. {
  32. IHTMLDocument2 *html;
  33. wb->Document->QueryInterface<IHTMLDocument2>(&html);
  34. html->put_designMode(L"On");
  35. html->Release();
  36. }
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::btnInsertImageClick(TObject *Sender)
  40. {
  41. if (wb->Document)
  42. {
  43. IHTMLDocument2 *html;
  44. wb->Document->QueryInterface<IHTMLDocument2>(&html);
  45. VARIANT var;
  46. VARIANT_BOOL receive;
  47. html->execCommand(L"InsertImage",true,var, &receive);
  48. html->Release();
  49. }
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TForm1::btnGetHtmlClick(TObject *Sender)
  53. {
  54. if (wb->Document)
  55. {
  56. IHTMLDocument2 *html;
  57. wb->Document->QueryInterface<IHTMLDocument2>(&html);
  58. IHTMLElement *pElement;
  59. html->get_body(&pElement);
  60. pElement->get_parentElement(&pElement);
  61. wchar_t *tmp;
  62. pElement->get_outerHTML(&tmp);
  63. Memo1->Lines->Text = tmp;
  64. pElement->Release();
  65. html->Release();
  66. }
  67. }
  68. //---------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment