![]() |
Context Menu, Mehrere Filenames übergeben
Hallo,
Ich programmierer atm an einem Context Menu Handler. Er ist bereits fertig und alles funktioniert wie geplant, bis auf eines. Er übergibt aus irgendeinem Grund nur einen Filename. Ich verwende diesen Code zum bekommen der Filenames:
Delphi-Quellcode:
Und später wird das Prog mit FFilename gestartet, aber es ist nur ein Filename drin und ich habe keine Ahnung woran es liegt und wie ich es ändern könnte.
var
StgMedium: TStgMedium; FormatEtc: TFormatEtc; i: Integer; begin if lpdobj = nil then begin Result := E_INVALIDARG; Exit; end; with FormatEtc do begin cfFormat := CF_HDROP; ptd := nil; dwAspect := DVASPECT_CONTENT; lindex := -1; tymed := TYMED_HGLOBAL; end; Result := lpdobj.GetData(FormatEtc, StgMedium); if Failed(Result) then Exit; { for i := 0 to DragQueryFile(StgMedium.hGlobal, $FFFFFFFF, nil, 0) - 1 do DragQueryFile(StgMedium.hGlobal, i, FFilename, sizeof(FFilename)); ReleaseStgMedium(StgMedium); Result := NOERROR; } if (DragQueryFile(StgMedium.hGlobal, $FFFFFFFF, nil, 0) = 1) then begin DragQueryFile(StgMedium.hGlobal, 0, FFileName, SizeOf(FFileName)); Result := NOERROR; end else begin FFileName[0] := #0; Result := E_FAIL; end; ReleaseStgMedium(StgMedium); end; Bitte um Hilfe & Guten Morgen! Max |
Re: Context Menu, Mehrere Filenames übergeben
Auszug aus einer meiner Shell-Erweiterungen; mach was draus:
Delphi-Quellcode:
Das dynamische Array am Schluss auch wieder auf Null setzen.
if(lpdobj = nil) then
begin Result := E_INVALIDARG; exit; end; with FormatEtc do begin cfFormat := CF_HDROP; ptd := nil; dwAspect := DVASPECT_CONTENT; lindex := -1; tymed := TYMED_HGLOBAL; end; Result := lpdobj.GetData(FormatEtc, StgMedium); if(failed(Result)) then exit; // how many files? iLen := DragQueryFile(StgMedium.hGlobal, $ffffffff, nil, 0); if(iLen >= 0) then begin // clean-up SetLength(dfl, iLen); for i := 0 to iLen - 1 do begin DragQueryFile(StgMedium.hGlobal, i, buf, sizeof(buf)); dfl[i] := buf; end; Result := NOERROR; end; ReleaseStgMedium(StgMedium); |
Re: Context Menu, Mehrere Filenames übergeben
Habe es jetzt doch anders gemacht und es funktioniert. Aber auf den jetzige Code wäre ich ohne deine Hilfe nie gekommen, die Idee mit dem Dynamischem Array ist einfach genial.
Danke nochmal, Max |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:10 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