FsDeleteFile - may be need option

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

FsDeleteFile - may be need option

Post by *Korney San »

Is there any way to determine what delete action is executing in FsDeleteFile: Del or Shift-Del ?
Praemonitus praemunitus
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

The only way you can do - is to check if Shift is pressed:

Code: Select all

bool is_shift=GetAsyncKeyState(VK_SHIFT)<0;
But note that TC calls your FsDeleteFile when you confirm deletion and not immediately after pressing Del or Shift+Del. So user needs to hold Shift when clicking OK in TC confirm dialog.
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

This is not "the right way", I suggest the FsDeleteFile definition must be updated from

Code: Select all

function FsDeleteFile(RemoteName:pchar):bool; stdcall;
to something like

Code: Select all

function FsDeleteFile(RemoteName:pchar; ShiftPressed:bool; UseTrash:bool):bool; stdcall;
where
ShiftPressed - state of Shift when Del was pressed;
UseTrash - state of corresponding TC option.

Ghisler, what are you think?
Praemonitus praemunitus
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I doubt Christian will change function prototype, it will be incompatible with tens of existing plugins.

BTW, it is much better to use single parameter with flags instead of two binary flags.
Post Reply