CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Right Click

  1. #1
    Join Date
    Mar 2003
    Location
    egypt
    Posts
    56

    Unhappy Right Click

    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
    -----------------------------------------

  2. #2
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241
    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).

  3. #3
    Join Date
    Mar 2003
    Location
    egypt
    Posts
    56
    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

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    1
    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.

  5. #5
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241
    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/showth...hreadid=242922

  6. #6
    Join Date
    Dec 2000
    Location
    Slovakia
    Posts
    1,043
    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

  7. #7
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241
    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.

  8. #8
    Join Date
    Dec 2000
    Location
    Slovakia
    Posts
    1,043
    Look for article "Extending Shortcut Menus" on MSDN... That article discribes how to do it...

    martin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured