The webbrowser of the parent in Delphi becomes a blank problem resolution (covering Createwnd and Destroywnd)

Source: Internet
Author: User

This time in a Delphi interface to open the function of the Web page, and this page is in the window can be fully displayed, can be reduced to another window on the panel display

However, when you change the window of the page, the WebBrowser control becomes blank.

Google on the internet for half a day, finally found on the CSDN solution:

Original address: http://bbs.csdn.NET/topics/200046109

[Delphi]View PlainCopy
  1. Uses
  2. SHDocVw, Windows, Controls, Forms, Classes;
  3. Type
  4. Tmywebbrowser = Class (Twebbrowser)
  5. Private
  6. protected
  7. Actualhandle:hwnd;
  8. procedure Createwnd; override;
  9. procedure Destroywnd; override;
  10. Public
  11. end;
  12. {Tmywebbrowser}
  13. Procedure Tmywebbrowser.  Createwnd;
  14. Begin
  15. if (Actualhandle <> 0) and IsWindow (actualhandle) Then
  16. begin
  17. WindowHandle: = Actualhandle;
  18. Actualhandle: = 0;
  19. Windows. SetParent (WindowHandle, Twincontrol (self). Parent.  Handle);
  20. //force A resize on the client window
  21. MoveWindow (WindowHandle, 0, 0, Twincontrol (self). Parent. Width,
  22. Twincontrol (self). Parent.   Height, true);
  23. End
  24. Else
  25. inherited;
  26. End
  27. Procedure Tmywebbrowser.  Destroywnd;
  28. Begin
  29. if (csdestroying in componentstate) Then
  30. inherited
  31. Else
  32. begin
  33. //parent to the application window which was 0x0 in size
  34. Windows. SetParent (WindowHandle, Forms. Application.  Handle);
  35. //save the WindowHandle
  36. Actualhandle: = WindowHandle;
  37. //set it to 0 so Createwnd'll be called again ...
  38. WindowHandle: = 0;
  39. end;
  40. End

The webbrowser of the parent in Delphi becomes a blank problem resolution (covering Createwnd and Destroywnd)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.