BleepingComputer.com: Creating a Context Menu Entry

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Creating a Context Menu Entry For all files, not folders

#1 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,422
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 11 October 2009 - 04:00 AM

So, I've written a nifty little app that does a cool thing using magic and Lucky Charms. Trouble is it's fairly useless unless I can cause it to be invoked from Explorer's context menu.

All I need to know is how to create a handler, in the registry preferably, that only shows up when a file is right-clicked (not a folder) and launches my program with the file's path as an argument.

Any help is appreciated.
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 11 October 2009 - 11:09 AM

I know how to add an option ot the context menu, but I don't know how to make it aware of the file type in order to determine whether or not it should be visible; I have a hunch that one would have to alter the right-click handler. I saw this a while back that looks promising that may give you an idea of how to do it, but I have never messed with it.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,407
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 11 October 2009 - 11:20 AM

Does it need to operate on any file or only certain types you're looking for?

What language is the app written in?

Billy3

#4 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,422
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 11 October 2009 - 05:27 PM

It needs to operate on any and all files of all types, but not directories. The app is written in RealBasic, which is similar in most respects to VB.

I'll take a look at FileMenu Tools. If need be, I'll create the handler with it and reverse engineer what it did to do it :thumbsup: Thanks guys!
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

#5 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,834
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 11 October 2009 - 08:36 PM

These are the manual steps. You can convert them into a function :

Lets assume your program is installed in path C:\Magic\Magic.exe

1. Create a subkey under HKCR\*\shell of any name you like. Lets say Magic, so final subkey you create would be HKCR\*\shell\Magic
2. Set the default value under this subkey to any name you want to appear in right-click context-menu say, Do Magic
3. Create a subkey command under the newly created key in step 1.
4. Set default value under this command key to path name of exe followed by %1. In this case "C:\Magic\Magic.exe" %1. The inverted commas are necessary only if path contains space.

You will immediately see the changes in context menu, no restart etc. is necessary. This way of handling context menu is used when you have to pass parameters directly to EXE. The newer extended way with GUID's is used when you have a special DLL to handle context menu.

EDIT: If you want to add context menu only to a particular type file just replace HKCR\* with extension of that type. For example, for text files (.txt), follow the process under the key HKCR\.txt\. The HKCR\* is for all types of files.

This post has been edited by Romeo29: 11 October 2009 - 08:38 PM


#6 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 11 October 2009 - 08:50 PM

That's cool! Can a person use regex expressions to limit the particular files, or can one just include an array of files one wants associated with the key?
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#7 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,422
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 11 October 2009 - 08:55 PM

Exactly what I was looking for! Thanks!
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

#8 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,422
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 12 October 2009 - 12:35 AM

Everything works perfectly now.
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

#9 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,834
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 12 October 2009 - 11:34 AM

View Postgroovicus, on Oct 11 2009, 09:50 PM, said:

That's cool! Can a person use regex expressions to limit the particular files, or can one just include an array of files one wants associated with the key?

In my opinion, regex is not allowed, you have to repeat process for each type of file you want.

View PostAmazing Andrew, on Oct 12 2009, 01:35 AM, said:



Nifty app :thumbsup:

#10 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,407
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 12 October 2009 - 11:44 AM

I'll have to take a look. :grin: This is the one I use, but it doesn't do virus total.

Billy3

This post has been edited by Billy O'Neal: 12 October 2009 - 11:45 AM


#11 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,422
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 12 October 2009 - 04:30 PM

View PostRomeo29, on Oct 12 2009, 09:34 AM, said:

Nifty app :thumbsup:

View PostBilly O, on Oct 12 2009, 09:44 AM, said:

I'll have to take a look. :grin: This is the one I use, but it doesn't do virus total.

Thanks!

I had been using MD5 Context Menu (still do, actually) but it was a pain to have to Copypasta each checksum manually.
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users