UPD: Use native delete function when call from context menu under Windows (fixes problem with UAC)

This commit is contained in:
Alexander Koblov 2012-02-07 06:41:07 +00:00
commit 3233eeebdc
2 changed files with 11 additions and 16 deletions

View file

@ -262,6 +262,7 @@ var
bHandled : Boolean = False;
ZVerb: array[0..255] of char;
sVerb : String;
Result: HRESULT;
FormCommands: IFormCommands;
begin
try
@ -384,15 +385,7 @@ begin
begin
sVerb := StrPas(ZVerb);
if SameText(sVerb, sCmdVerbDelete) then
begin
if ssShift in GetKeyShiftState then
frmMain.Commands.cm_Delete('recyclesettingrev')
else
frmMain.Commands.cm_Delete('recyclesetting');
bHandled := True;
end
else if SameText(sVerb, sCmdVerbRename) then
if SameText(sVerb, sCmdVerbRename) then
begin
if FFiles.Count = 1 then
with FFiles[0] do
@ -452,15 +445,18 @@ begin
FillChar(cmici, SizeOf(cmici), #0);
with cmici do
begin
cbSize := sizeof(cmici);
cbSize := SizeOf(cmici);
hwnd := FParent.Handle;
lpVerb := PChar(PtrUInt(cmd - 1));
nShow := SW_NORMAL;
end;
OleCheckUTF8(FShellMenu1.InvokeCommand(cmici));
Result:= FShellMenu1.InvokeCommand(cmici);
if not (Succeeded(Result) or (Result = COPYENGINE_E_USER_CANCELLED)) then
OleErrorUTF8(Result);
// Reload after possible changes on the filesystem.
if SameText(sVerb, sCmdVerbLink) then
if SameText(sVerb, sCmdVerbLink) or SameText(sVerb, sCmdVerbDelete) then
frmMain.ActiveFrame.FileSource.Reload(frmMain.ActiveFrame.CurrentPath);
end;

View file

@ -34,11 +34,8 @@ uses
}
const
{ NewMenu Object (Creates a "New" context menu for a Shell item) }
CLSID_NewMenu: TGUID = '{D969A300-E7FF-11d0-A93B-00A0C90F2719}';
// QueryContextMenu uFlags
CMF_FINDHACK = $00000080;
CMF_FINDHACK = $00000080;
SEE_MASK_UNICODE = $00004000; //Correction
SEE_MASK_HMONITOR = $00200000;
@ -55,6 +52,8 @@ const
// CMIC_MASK_FLAG_SEP_VDM = SEE_MASK_FLAG_SEPVDM; ??
// CMIC_MASK_HASTITLE = SEE_MASK_HASTITLE; ??
// User canceled the current action
COPYENGINE_E_USER_CANCELLED: HRESULT = $80270000;
{ IPersistFolder3 Interface }
{