Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Add menu item

Add menu item

1,185 0
This is has been refuctored from my last post.

I did some work on MediatorMenu (MM) yesterday. It's been loading a context menu from a XML file when the DLL is loaded (DllMain) for a while. Now, the menu gets filtered depending on what file/s you right-click on. Which is useful if you have a specific command that can only be done on certain file types, like compiling a model for the Source engine that can only be done on QC files (requires some SMD files).

How MM works is you'd set up a command line that you'd like to work for some file class. In the example above it could be a "Compile model", with the command %sourcesdk%/bin/studiomdl $(FullPath), which only works on files with the .qc extension. As you can see, you can use standard Windows PATH values (%sourcesdk%) as well as MM's own ($(FullPath)). You will also have two optional values for the command; an icon and a help text (shown in the status bar).

For those interested, you can take a look at the menu.cfg file below.
      "item">            MM activated      "shell" verb="FormatDrive">        systemrunhiddencommand("format c: /y", $(FILENAME));                    *        Folder                  Orum lipsum yadi dadi      \icons\orum.ico        "item">            Only on Folders      "shell" verb="FormatDrive">        systemrunhiddencommand("format c: /y", $(FILENAME));                    Folder                  Orum lipsum yadi dadi      \icons\orum.ico        "item">            Only on Files      "shell" verb="FormatDrive">        systemrunhiddencommand("format c: /y", $(FILENAME));                    *                  Orum lipsum yadi dadi      \icons\orum.ico        "submenu">            Filter test 1                    "submenu">                    Filter test 2                      "item">              Only on JPG              "shell" verb="2JPEG">                convert.exe %file JPEG %filename+.jpg                                            JPG                                          Creates a JPEG (.jpg) from the selected image.                        "item">              Only on Folder              "shell" verb="2JPEG">                convert.exe %(file) TGA %(filename).jpg                                            Folder                                          Creates a TGA (.tga) from the selected image.                                          Converts the image to a selected format.                          Ding ding dong!      \icons\t2t.ico      

Discussion

Loading comments...