Инструменты пользователя

Инструменты сайта


works:programmer:delphi:twebbrowser

Delphi TWebBrowser интересные настройки

Отключаем вторую кнопку мышки

  var hMouseSecondButton: HHOOK;
 
  function MouseHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
  const IE_PROCNAME = 'Internet Explorer_Server';
  var
    szClassName: array[0..255] of Char;
    MouseMsg: PMouseHookStruct;
  begin
    if nCode >= 0 then begin
      if (wParam = WM_RBUTTONDOWN) or (wParam = WM_RBUTTONUP) then begin
        GetClassName(PMouseHookStruct(lParam)^.hwnd, szClassName, SizeOf(szClassName));
        if lstrcmp(@IE_PROCNAME[1], @szClassName[0]) = 0 then begin
          Result := HC_SKIP;
          Exit;
        end;
      end;
    end;
    Result := CallNextHookEx(hMouseSecondButton, nCode, wParam, lParam);
  end;
 
  procedure TfmMain.FormCreate(Sender: TObject);
    hMouseSecondButton := SetWindowsHookEx(WH_MOUSE, MouseHookProc, 0, GetCurrentThreadId);
  end;
 
  procedure TfmMain.FormDestroy(Sender: TObject);
  begin
    UnhookWindowsHookEx(hMouseSecondButton);
  end;
works/programmer/delphi/twebbrowser.txt · Последнее изменение: 2024/11/17 19:34 — tuxapuk

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki