The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: bozo on October 01, 2005, 10:37:24 PM

Title: Menu Context Handler
Post by: bozo on October 01, 2005, 10:37:24 PM
A friend of mine was asking how he could use his own options in a right-click menu of folder objects.
I know its to do with IContextMenu interface, COM related.

Has anyone written one in assembly, or know of any source already out there?

thanks
Title: Re: Menu Context Handler
Post by: PBrennick on October 03, 2005, 03:16:00 AM
What do you mean by 'options'

P
Title: Re: Menu Context Handler
Post by: Tedd on October 03, 2005, 10:20:09 AM
He means adding context menu items - right-click on a file of a particular type gives you the usual menu plus your own (program) associated menu items.

You 'can' do it by adding registry entries into the appropriate file type under HKEY_CLASSES_ROOT
But I assume there will be an API way to do it too - of course I'm not being much help because I don't know what that is ::)
Title: Re: Menu Context Handler
Post by: Jimg on October 03, 2005, 03:40:12 PM
Another way would be to write a registry command file (eg.  Dip.reg)  and execute it.  To add the program E:\Program Files\Dip.exe  to the folder context menu, I use a file with this contents:




Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Dip]

[HKEY_CLASSES_ROOT\Directory\shell\Dip\command]
@="\"E:\\Program Files\\Dip\\Dip.exe\""

[HKEY_CLASSES_ROOT\Drive\shell\Dip]

[HKEY_CLASSES_ROOT\Drive\shell\Dip\command]
@="\"E:\\Program Files\\Dip\\Dip.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Dip]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Dip\command]
@="\"E:\\Program Files\\Dip\\Dip.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\Dip]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\Dip\command]
@="\"E:\\Program Files\\Dip\\Dip.exe\""




Also, if anyone knows how to add to the context menu you get when you right click on the desktop, I would like to know it please.
Title: Re: Menu Context Handler
Post by: bozo on October 05, 2005, 02:15:01 AM
well, this guy wanted to add menu item for java compiler whenever he right clicked on a java source code file.
apparently you write a handler in a DLL file, and register it with regsvr32.exe.
i found some source in c since, but no asm.
Title: Re: Menu Context Handler
Post by: PBrennick on October 06, 2005, 03:38:23 AM
The java compiler is a command line tool.  ?????

P
Title: Re: Menu Context Handler
Post by: bozo on October 06, 2005, 05:53:42 AM
javac.exe - console based java compiler.
Title: Re: Menu Context Handler
Post by: Tedd on October 06, 2005, 10:55:11 AM
Why not just do it through mycomputer->tools->folderoptions->filetypes ??
Title: Re: Menu Context Handler
Post by: bozo on October 06, 2005, 11:22:43 AM
the full command he wanted was "cmd.exe /c "C:\j2sdk1.4.2_03\bin\javac.exe %1 | more && pause"

the problem with this, was %1 expanded to 8.3 format..and javac.exe is strict
about name of source file, must be File.java if that is name of class, else it complains.

%1 would have something like:d:\DOCUME~1\user\MYDOCU~1\java\MYSECO~1.JAV
which is no good.
Title: Re: Menu Context Handler
Post by: GregL on October 07, 2005, 08:12:14 PM
Try enclosing %1 in double quotes.

cmd.exe /c "C:\j2sdk1.4.2_03\bin\javac.exe" "%1" | more && pause

Title: Re: Menu Context Handler
Post by: bozo on October 08, 2005, 01:30:23 AM
i will tell him to try this,thanks again Greg :)