去掉TWebBrowser的滚动条
【打印文章】
参见以下代码:
var
Form1 : TForm;
HookID : THandle;
DisableRButton : boolean;
implementation
function MouseProc(nCode: integer; wParam,
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;
var
Form1 : TForm;
HookID : THandle;
DisableRButton : boolean;
implementation
function MouseProc(nCode: integer; wParam,
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;
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】