Click to See Complete Forum and Search --> : Right Click


saudyonline
May 8th, 2003, 04:46 PM
hi there
first i wanna thank you for all your answers of my questions
-------------------------------------------------------------
my question NOW is

how can i make my program to be in mouse RIGHT CLICK
when my program was installed
then i can run from specific file or any file

thank you

please: give me an example of code
-----------------------------------------:rolleyes: :confused:

KingTermite
May 9th, 2003, 07:44 AM
If you mean to have a right click menu...you need to add a context menu.

If you mean to do something (not show a menu) when you right click, you could probably make a context menu with no menu items and then add what you want to do to the contextmenu_popup event.

Or....many controls have events that are available to override...there might be a rightclick event for the control (like the form) where you want it to happen.

Sorry I can't provide code at the moment as I'm at work..not at home where my C# code is.

I could, if you needed, provide some of the context menu code. The last option I mentioned is only a guess...I'm not 100% sure that event exists....but its worth a look (and probably the best way to do it if it exists).

saudyonline
May 13th, 2003, 06:16 PM
thank you for your answer

but please try to give me this code of context menu

as
when you for example setup winrar you will see it or run it by right click on a folder
that is what i want

PhrostByte
May 14th, 2003, 04:57 AM
You'll have to dive into the registry.

I'm too tired to write an example of code, maybe in the morning. However you can look in HKEY_CLASSES_ROOT for a file extension (eg ".cs"). The (default) value of that key is another key (eg "VisualStudio.csfile.7.1")

It's on msdn somewhere also, search for Windows Shell.

KingTermite
May 14th, 2003, 10:19 AM
No..no...you don't need to get into the registry if it is a context menu for your own program. It's relatively simple.

I did some code to add images into a context menu. You can ignore the images and user drawn stuff if you don't need icons/images in the menu and just want a basic menu.

Here's the post:
http://www.codeguru.com/forum/showthread.php?s=&threadid=242922

MartinL
May 14th, 2003, 10:42 AM
Termite, I think he wants something totaly different...

He wants extend shell context menu. It means, when you are in for example windows explorer and you right-click on some file then you see his application in that shell context menu (as for example WinRar inserts there menu items "Add to archive..." and "Add to filename.rar")...

He has to get into the registry for this purpose!

martin

KingTermite
May 14th, 2003, 11:00 AM
Originally posted by MartinL
Termite, I think he wants something totaly different...

He wants extend shell context menu. It means, when you are in for example windows explorer and you right-click on some file then you see his application in that shell context menu (as for example WinRar inserts there menu items "Add to archive..." and "Add to filename.rar")...

He has to get into the registry for this purpose!

martin Ok, Gotcha! That's why I added the "if your own program". I thought he was doing it for his own program.

Sorry...my bad! ;)

In that case....answer away, and if you get it working saudyonline, post info here...I'd like to do that myself very soon.

MartinL
May 14th, 2003, 11:09 AM
Look for article "Extending Shortcut Menus" on MSDN... That article discribes how to do it...

martin