• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

去掉TWebBrowser的滚动条_Delphi

Delphi 搞代码 3年前 (2018-08-09) 196次浏览 已收录 0个评论

参见以下代码:

var
Form1 : TForm;
HookID : THandle;
DisableRButton : boolean;

implementation

function MouseProc(nCode: integer; wParam,

http://www.gaodaima.com/?p=65861去掉TwebBrowser的滚动条_Delphi

lParam: longint): longint; stdcall;
function GetClassNameEnh(Handle: Hwnd): string;
var
ClassName: PChar;
Buffer: integer;
begin
Buffer := 40;
getmem(ClassName, Buffer);
windows.GetClassName(Handle, ClassName, Buffer);
Result := ClassName;
Freemem(ClassName);
end;

var
P: TPoint;
begin
if (nCode < 0) then
Result := CallNextHookEx(HookID, nCode, wParam, lParam)
else if DisableRButton and ((wParam = WM_RBUTTONDOWN) or (wParam =
WM_RBUTTONUP)) then
begin
GetCursorPos(P);
if Pos(‘Internet Explorer_’, GetClassNameEnh(WindowFromPoint(P))) <> 0
then
Result := HC_SKIP
else
Result := CallNextHookEx(HookID, nCode, wParam, lParam);
end
else
Result := CallNextHookEx(HookID, nCode, wParam, lParam);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
DisableRButton := True;
HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0,
GetCurrentThreadId());
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
if HookID <> 0 then
UnHookWindowsHookEx(HookID);
end;

欢迎大家阅读《去掉TWebBrowser的滚动条_Delphi,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址