Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a file's context dialog, default action and etc

In Windows when one is in Windows Explorer and right clicks a file or directory, a Windows context menu appears with all of the actions that one can do regarding this file or directory.

Way back in the day, Brad Stowers wrote a unit ItemProp.pas that did the exact same thing within one's own Delphi application. This unit works great through Delphi 5, but for D7 and above, a lot of errors are thrown.

http://www.koders.com/delphi/fid7ABE724EBD5F2123FF824AFD45151D2A087C5E6C.aspx?s=network

Okay! I admit it! I AM lazy and have Googled for an updated unit and even one like this, have worked for a couple hours trying to make this unit at least D7 compatible but I guess I am missing something somewhere as I have not been successful in any endeavor regarding this.

So... my question is, has anyone updated this unit for D7 and above OR does a unit or component exist that does what this code does?

Thanks in advance!

John

like image 510
John Avatar asked Nov 03 '11 03:11

John


2 Answers

I suspect all that is needed is to update the compiler version directives in DFS.inc

I added

{$DEFINE DFS_DELPHI}
{$DEFINE DFS_COMPILER_4_UP}
{$DEFINE DFS_NO_COM_CLEANUP}
{$DEFINE DFS_COMPILER_3_UP}

to the main file (ItemProp.pas), and it compiled OK on Delphi 2007, but I haven't tried running the code yet.

like image 109
Gerry Coll Avatar answered Dec 01 '22 08:12

Gerry Coll


Instead of translate this unit you can use the updated JEDI JCL library, check the JclShell unit, inside of this unit exist a function called DisplayContextMenu whcih shows the shell context menu for a File.

function DisplayContextMenu(const Handle: HWND; const FileName: string;
  Pos: TPoint): Boolean;
like image 25
RRUZ Avatar answered Dec 01 '22 09:12

RRUZ