How can I extend the context menu of a wfx plugin

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

Moderators: Hacker, petermad, Stefan2, white

pi
Junior Member
Junior Member
Posts: 23
Joined: 2005-03-29, 09:30 UTC
Location: Aachen

How can I extend the context menu of a wfx plugin

Post by *pi »

Hi folks,

I just wrote a little FS plugin for a serial storage device.
Now I need to extend the entries of the device context menu.
The menu currently looks like that:
  • [\My_Device]
    Eigenschaften
("Eigenschaften" is "properties" in German).
The latter one I use to set the serial communication parameters like Com port and baud rate.
But I need two special functions for the device, so I want to extend the context menu to offer these functions.
The sample plugin and the wfx plugins with source code available (Ext2+/Reiser, HTTP browser, WinCE) don't provide such an extension and the FS-Plugin writer's guide doesn't address that theme.

So maybe you can give me a clue?

Language is VisualC++ (in fact, my code is native C).

Thanks in advance,
pi
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

I believe context menu extension is just not possible. But there are quite some alternatives here as you may probabely have seen from other file system plugins.
1) Display "dummy" files or directories which show your required information when they are opend or entered, respectively.
2) Add strings to the command line which get caught by the third parameter of FsExecuteFile.

TBeu
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

pi
Junior Member
Junior Member
Posts: 23
Joined: 2005-03-29, 09:30 UTC
Location: Aachen

Post by *pi »

@tbeu: since my device contains a real (FAT) file system, 1) is not appropriate.
2) may be an idea, but how shall I invoke the extra commands?

To be a bit more specific, the extra commands are "create image from device" and "put image on device". These are functions that don't operate on files but on the whole device.

@lefteous: THAT'S IT! But it seems to be a wish list rather than an existing way to do it... 8-(
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

It can be done via hooks (not system hooks, since your code will run inside TC)

You have to monitor popup class.
Alternative is to set custom button text in F3 F4... F8 function buttons and to catch that event. TO do so you can sublass button class to catch events , get the handles before that, change the name of the buttons (for instance you can set on F4 Properties) etc...

Ohter solution is to monitor right mouse clicks, also via local hook, and to forbid TC to show its own menu while your plug is active, then you can display your popup .


ALl solutions are quite easy, so it all depends on how you handle Windows API programming.
Habemus majkam!
pi
Junior Member
Junior Member
Posts: 23
Joined: 2005-03-29, 09:30 UTC
Location: Aachen

Post by *pi »

majkinetor ! wrote:You have to monitor popup class.
Never done that...
majkinetor ! wrote:Alternative is to set custom button text in F3 F4... F8 function buttons and to catch that event. TO do so you can sublass button class to catch events , get the handles before that, change the name of the buttons (for instance you can set on F4 Properties) etc...
This is a bad idea since one of the main advantages of TC is that you can use it blindfolded - so re-using these function buttons leads to chaos and anarchy! 8-)
majkinetor ! wrote:Ohter solution is to monitor right mouse clicks, also via local hook, and to forbid TC to show its own menu while your plug is active, then you can display your popup .
Also a solution that disables some of TCs features. I would prefer a solution that does not interfer with existing functions.
majkinetor ! wrote:ALl solutions are quite easy, so it all depends on how you handle Windows API programming.
Well, in my plugin I don't handle Windows API programming at all (at least now). The only "GUI" I use is done via RequestProc() to get the com port parameters.
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

2pi
Oh pi, you are not searious programmer nor your arguments are good. I don't have time to explain now, hopefully you will understand one day.

Sorry to take your time.
Habemus majkam!
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

2pi
Because you already know how you want the popup to look alike you can recreate the popup by use of local hooks as majkam said.
My_Device
Properties
Create image from device
Put image on device
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
pi
Junior Member
Junior Member
Posts: 23
Joined: 2005-03-29, 09:30 UTC
Location: Aachen

Post by *pi »

@tbeu: OK, as I said: Never done that. Can you give me an example?

@majkinetor: You are nearly right: I am not a serious Windows GUI programmer.
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

2pi
You need to be a serious programmer if you want to be a serial programmer :)
To be serious I have not yet programmed hooks. The one application I know that uses hooks is CLCL. Maybe you can learn from it. But not sure if system or local hooks.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
pi
Junior Member
Junior Member
Posts: 23
Joined: 2005-03-29, 09:30 UTC
Location: Aachen

Post by *pi »

@tbeu: Thanks, I will have a look at it. Well, in fact I am a serial programmer! 8-)

And I am still willing to learn things I can't do now. Maybe majkinetor will have some time for me in the future...
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

tbeu wrote:You need to be a serious programmer
Well, pi isn't saying anything against it =) :
pi wrote:I am not a serious **Windows GUI** programmer.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Maybe majkinetor will have some time for me in the future...
Yes he will :)

The local hook is sufficient for you.
CLCL is wrong choice to do learning. It is on Japanise, and is very complicated.

You have many examples on the net how to hook, it is well known technique. Basicly you call some function that installs hoook, you give her pointer to your function that will Windows call on events you want to monitor, set the hook type, and thats it. You can later choose to process event, to skip it, or even to forbid hooked application to receive it. System hooks are far far wors, but they are needed to handle windows in other adress spaces and you don't need that since you are controling TC within TC. So, you got the easier part.
Habemus majkam!
djorge
Senior Member
Senior Member
Posts: 422
Joined: 2003-07-03, 12:48 UTC
Location: Portugal

Post by *djorge »

I have no experience with Hooks, but won't the other FSPlugins show the new items too in context menu?
______________________
David Jorge
Personal License #117854
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I recommend that you do NOT use hooks and other dirty tricks to put your menu items into Total Commander. Why? While this may work perfectly with the current version of TC, it's possible that it will not work with future versions (e.g. because there may be actually a context menu interface), or with other programs which use the plugin...
Author of Total Commander
https://www.ghisler.com
Post Reply