本文整理自网络,侵删。
Delphi中禁止WebBrowser右键的方法
uses MSHtml;
//在控件标签additional中找到TApplicationEvents控件,拖到窗体上.在TApplicationEvents的OnMessage事件中加入以下代码:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message = wm_rbuttondown) or (Msg.message = wm_rbuttonup) or
(msg.message = WM_RBUTTONDBLCLK) then
begin
if IsChild(Webbrowser1.Handle, Msg.hwnd) then
Handled := true;//如果有其他需要处理的,在这里加上你要处理的代码
end;
end;
相关阅读 >>
Delphi winapi: getforegroundwindow - 获取前台窗口的句柄
Delphi 泛型容器单元(generics.collections) tdictionary<t>
Delphi2010:把stringgrid数据保存到excel
更多相关阅读请进入《Delphi》频道 >>