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

User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

e.g. because there may be actually a context menu interface
Then we'll contact pi and ask him to rewrite his plugin a bit.
with other programs which use the plugin
Do you really care for OTHER programs using plugins made for YOUR program?
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 ! »

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...
Don't listen to Mr. Ghisler.

I wont comment his comment more then this, since some of us were suggesting here plugin interface changes for more then year that bunch of other users supported, together with some moderators and current plugin developers, and he choosed to ignore them all because of some ....... badly described invalid reasons... Other reason is that Mr Ghisler is only concerned about how to make as much money as possible from selling Total Commander and how to pay as little attention as possible for users of Total commander, so he will not tolerate hard worked freeware plugins that may eventualy crash his child in the year 2010.... or something like that.

So, just do it. Your program is only imporatant. If you care for compatibility with newer version of TC, describe somewhere in manual eventual problems or update your plugin regulary (witch means once in 2,3 years, according to the frequency of plugin changes so far)

2XPEHOPE3KA
Hej, what happend to you ? You sound much reasonable today :)

2 djoge
I have no experience with Hooks, but won't the other FSPlugins show the new items too in context menu?
The original context menu can be extened this way, thus keeping the existing menu items. Also, some check can be made to show custom menu only when panel presenting FS plug is activated.
Habemus majkam!
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

You sound much reasonable today
As usual... :cool:
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 ! »

And you became funny....

What happend to you man :?:
Habemus majkam!
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

As a starting point I added a local mouse hook to the sample file system plugin 'Drives'.

The problems are:
* hook is only called when plugin is loaded
* hook is called in every other client area, too, e.g. in lister indow
* do not know how to call the default action for '\Drives' menu item

You can get it from here and try it yourself.

tbeu
Last edited by tbeu on 2006-09-14, 20:14 UTC, edited 1 time in total.
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
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

I don't understand.

You say
* hook is only called when plugin is loaded first
witch means that it doesn't work afterwards.

And then you say
* hook is called on every other file system plugin, too
So, you say that , it stops working in your own plugin, but continues to run for others ?

BTW, in AutoHotkey you can do it with following command

Code: Select all

#IfWinActive ahk_class TTOTAL_CMD
RButton::
   <AHK code to get currently selected panel>
   if ( tcPanel != "myPluginName")
   {
       ;send this click, not for my plugin
        Click
        return
    }
   else ShowMyMenu()
return 
#IfWinActive
This means that it can be done succesifuly.

2 tbeu
Be aware that hooks can be very hard to control when you first start working with them. There are number of things that can go the wrong way, and it can be very hard to find bugs.

AFAIK, AHK uses system hooks to achive above funcionality (even if #IfWinActive directive is present).

System hooks are story for itself.... even harder since all system hooks are placed in the so called "hook chain". One above you may foribid you to receive messages since it will catch it before you.

Maybe the easier way, and muche more able to work is to replace WinProc of Total Commander itself mouse clicks, passing everything else to TC, only when your plugin is active (Ghisler will go crazy now. You have code for this in my favmenu script, under tc_functions.ahk).
After your plugin is closed, you can finish sublcasing and relax.
Habemus majkam!
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

2majkam
I mean the WFX plugin must first be loaded by TC to activate the hook. If you start a new instance of TC and go to 'Network Neighbourhood' to the plugin and do the right mouse click the hooked context menu is not yet available. So you have to enter the plugin before to load it.
Anyway, it is just a starting point and probably a dead end...
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
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

This was a story about context menu inside plugin space, you first time say now that you want something else.

For context menu in NN this is an idea:

You have to start hook as TC starts. This can be for instance achieved by adding dummy invisible context plugin field at the end of last row. This special context plugin will be called as soon as TC starts, and will be called for eatch file. On first run you install the subclass and after that return imediately...
Habemus majkam!
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

you first time say now that you want something else
It was written in the first post. ;)

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Then I missunderstood the question.

Also, the Leftious has to do with this since he added
Custom_context_menus_in_file_system_plugins

and user said:
@lefteous: THAT'S IT! But it seems to be a wish list rather than an existing way to do it... 8-(
witch doesn't appear to me as connected to outer Properties menu.

Be it this way... the same story holds, a hook just needs to be started earlier. I described one of the ways above.

There is another way, to add your dll to location in registry witch says that you want it to be loaded with every application. In your dll you choose to exit for anything that is not equal to TC. WHen you recognise the TC you can start the hook and relax again. This way you can do all kind of "dirty tricks" to TC, like creating all kind of missing extensions, hotkeys that will launch your plugin or some of its features without it running etc..
Habemus majkam!
Post Reply