(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: TWebBrowser soll kein Popup Menü zeigen
24. Jan 2005, 06:51
Delphi-Quellcode:
var
Form1: TForm1;
HookID: THandle;
implementation
{$R *.DFM}
function MouseProc(nCode: Integer; wParam, lParam: Longint): Longint; stdcall;
var
szClassName: array[0..255] of Char;
MausPos: TPoint;
X, Y: Integer;
const
ie_name = 'Internet Explorer_Server';
begin
GetCursorPos(MausPos);
x := MausPos.x;
y := MausPos.y;
case nCode < 0 of
True:
Result := CallNextHookEx(HookID, nCode, wParam, lParam)
else
case wParam of
WM_RBUTTONDOWN,
WM_RBUTTONUP:
begin
GetClassName(PMOUSEHOOKSTRUCT(lParam)^.HWND, szClassName,
SizeOf(szClassName));
if lstrcmp(@szClassName[0], @ie_name[1]) = 0 then
begin
Result := HC_SKIP;
Form1.popupmenu1.popup(X, Y);
end
else
Result := CallNextHookEx(HookID, nCode, wParam, lParam);
end
else
Result := CallNextHookEx(HookID, nCode, wParam, lParam);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
HookID := SetWindowsHookEx(WH_MOUSE, MouseProc, 0, GetCurrentThreadId());
Webbrowser1.Navigate('http://www.google.com');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if HookID <> 0 then
UnHookWindowsHookEx(HookID);
end;
Thomas
|
|
Zitat
|