Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#6

Re: Shellextension - OnFileClick

  Alt 21. Mär 2008, 18:08
Hi,

Damals war es: IShellExtInit und IContextMenu:

TEncryptContextMenu = class(TComObject, IShellExtInit, IContextMenu) Bei deiner Möglichkeit müsste ich das ganze mit nem Hook lösen oder?

Mein Code ist bisher folgender:

Delphi-Quellcode:
library Hookdll;

uses
  Windows, Messages, CommCtrl, Dialogs;

var
  HookHandle: THandle;

function ClickHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  if nCode = HC_ACTION then
  case PMsg(lParam)^.message of
    NM_CLICK:
      ShowMessage('NM_CLICK!'); // wobei es so nicht geht weil NM_CLICK < 0 und
                                // PMsg(lParam)^.message: Cardinal deswegen hatte ichs mal so:

   // case Integer(PMsg(lparam)^.Message) of
   // NM_CLICK: ...
  end
  else
  Result := CallNextHookEx(HookHandle, nCode, wParam, lParam);
end;

function InstallHook: Boolean; stdcall;
begin
  Result := false;
  if HookHandle = 0 then
  begin
    HookHandle := SetWindowsHookEx(WH_GETMESSAGE,@ClickHook,
                                   hInstance,0);
    Result := true;
  end;
end;

function UnInstallHook: Boolean;
begin
  Result := UnhookWindowsHookEx(HookHandle);
  HookHandle := 0;
end;

exports
  InstallHook,
  UnInstallHook;

begin

end.
Aber ich bekomme irgendwie gar keine Message abgefangen. Aber ClickHook wird schon aufgerufen, das habe ich beim Debuggen festgestellt.

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat