was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

34 Visitors Online


 
...im TWebbrowser ein eingenes PopUp-Menu verwenden?
Autor: Dev4u.ch
Homepage: http://www.dev4u.ch
[ Tip ausdrucken ]  

Tip Bewertung (9):  
     


{
based on: http://www.swissdelphicenter.ch/de/showcode.php?id=571
basierend auf: http://www.swissdelphicenter.ch/de/showcode.php?id=571
}

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;

  if (nCode < 0) then
    
Result := CallNextHookEx(HookID, nCode, wParam, lParam)
  else if ((wParam = WM_RBUTTONDOWN) or (wParam = WM_RBUTTONUP)) then
  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;



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;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners