AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Kontextmenü des Explorers anzeigen
Thema durchsuchen
Ansicht
Themen-Optionen

Kontextmenü des Explorers anzeigen

Offene Frage von "Exceeder"
Ein Thema von Exceeder · begonnen am 26. Aug 2009 · letzter Beitrag vom 27. Aug 2009
Antwort Antwort
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.549 Beiträge
 
Delphi 12 Athens
 
#1

Re: Kontextmenü des Explorers anzeigen

  Alt 26. Aug 2009, 17:26
irgendwo in der DP dürften sich auch noch die Originalcodes rumliegen, aus welchen ich dieses mal erstellt hatte
Delphi-Quellcode:
  Procedure ContextMenuForFile(Wnd: HWND; FileName: String; X, Y: Integer);
    Var ContextMenu: IContextMenu;
      Popup: HMENU;
      CmdInfo: TCMInvokeCommandInfo;
      PIDL: PItemIDList;
      ShellFolder: IShellFolder;
      Eaten, Attr: LongWord;
      FileDir: String;

    Begin
      If SHGetDesktopFolder(ShellFolder) <> NO_ERROR Then Exit;
      FileDir := ExtractFileDir(FileName);
      FileName := ExtractFileName(FileName);
      If (FileDir <> '') and ((ShellFolder.ParseDisplayName(Wnd, nil, PChar(FileDir), Eaten, PIDL, Attr) <> NO_ERROR)
        or (ShellFolder.BindToObject(PIDL, nil, IID_IShellFolder, Pointer(ShellFolder)) <> NO_ERROR))
        or (ShellFolder.ParseDisplayName(Wnd, nil, PChar(FileName), Eaten, PIDL, Attr) <> NO_ERROR)
        or (ShellFolder.GetUIObjectOf(Wnd, 1, PIDL, IID_IContextMenu, nil, Pointer(ContextMenu)) <> NO_ERROR) Then Exit;
      Popup := CreatePopUpMenu;
      If Popup = 0 Then Exit;
      Try
        If Failed(ContextMenu.QueryContextMenu(Popup, 0, 1, $7FFF, CMF_NORMAL)) Then Exit;
        FillChar(CmdInfo, Sizeof(TCMInvokeCommandInfo), 0);
        CmdInfo.cbSize := SizeOf(TCMInvokeCommandInfo);
        CmdInfo.lpVerb := PAnsiChar(TrackPopupMenuEx(Popup, TPM_LEFTALIGN or TPM_RETURNCMD
          or TPM_RIGHTBUTTON or TPM_HORIZONTAL or TPM_VERTICAL, X, Y, Wnd, nil)) - 1;
        CmdInfo.nShow := SW_SHOWNORMAL;
        If CmdInfo.lpVerb = PAnsiChar(-1) Then Exit;
        ContextMenu.InvokeCommand(CmdInfo);
      Finally
        DestroyMenu(Popup);
      End;
    End;
als HWnd z.B. das Handle deiner Form
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:00 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz