Show the default right-click menu - Delphi

后端 未结 4 1641
你的背包
你的背包 2020-12-30 12:25

I have a Listbox which contain a list of files . can i access the Windows right-click menu in the listbox to access the open , properties , delete and rename items ?

4条回答
  •  半阙折子戏
    2020-12-30 13:09

    I'd recommend looking at something like tpShellShock when you want to show shell like controls in your Delphi app. It offers tree views, list views etc. that can be connected together much like an Explorer Windows. It will display the appropriate icons for the files. I'm sure it offers the facilities you talk about too.

    It might need some porting work if you are on a modern Unicode Delphi, but when I have done that it proved relatively straightforward.

    No doubt there are other libraries that offer shell controls, this is just the one I am familiar with.

    Otherwise if you want to stick with your current solution it's easiest to implement your own menu actions. Open and Properties are just simple calls to ShellExecute with the appropriate verb. Delete is a call to DeleteFile and Rename is a call to MoveFile.

提交回复
热议问题