[Delphi] replacing the original right-click with custom popupmenu in webbrowser

Source: Internet
Author: User

Webbrowser in Delphi is a browser with IE as the kernel. It is too simple, so we recommend that you useEmbedded Web BrowserControl!

Official Website: http://www.bsalsa.com/index.html

The webbrowser mentioned below refers to this control.

To shield webbrowser from the original context menu, it's easy

Function Tform1.embeddedwb1showcontextmenu ( Const Dwid: Cardinal;
Const PPT: Ppoint; Const Pcmdtreserved: iinterface;
Const Pdispreserved: idispatch): hresult;
Begin
Result: =   0 ; // If the returned result is false, the right-click is not displayed.
End ;

If you want to bring up other menus, you only need:

Function tform1.embeddedwb1showcontextmenu ( Const Dwid: Cardinal;
Const PPT: Ppoint; Const Pcmdtreserved: iinterface;
Const Pdispreserved: idispatch): hresult;
VaR PT: tpoint;
Begin
Getcursorpos (PT );
Popupmenu1.popup (Pt. X, Pt. Y); // a custom menu is displayed.
Result: =   0 ;
End;

Next, let's talk about different widgets on the web page, such as hyperlinks and text boxes.

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: info-contact@alibabacloud.com 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.