+ Reply to Thread
Results 1 to 6 of 6

Thread: add to windows context menu?

  1. #1
    Johnson is offline VB.NET Forum Fanatic Johnson is on a distinguished programming path ahead
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Mar 2009
    Age
    20
    Posts
    134
    Reputation
    23

    Default add to windows context menu?

    What i would like to do is have my application add a entry to the main windows context menu(for when i right click a picture) which will be called host image.

    My question is what do i need to read up on to add a context menu entry

    When the entry is clicked i want it to get the file it's clicked on location

    Does this make some sort of sense to you?

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,911
    Reputation
    670

    Default

    [ame=http://www.google.com.au/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=ErY&q=shell+extension+.net&btnG=S earch&meta=]shell extension .net - Google Search[/ame]

    It looks like it's easier to find C# examples so you might need to convert some code. I recommend Instant VB.

  3. #3
    Johnson is offline VB.NET Forum Fanatic Johnson is on a distinguished programming path ahead
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Mar 2009
    Age
    20
    Posts
    134
    Reputation
    23

    Default

    Right, i found a project to convert to vb.net.

    it adds a entry and lets you select what exe to run when click.

    My question is, I need to capture the file it was right clicked on, so when my application runs it knows what file to work with.

    is this difficult?

  4. #4
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Age
    37
    Posts
    11,055
    Reputation
    1564

    Default

    Most likely this info will be available in command line arguments. I don't know if registry path has to be modified in your case, often a %1 is appended.
    In applications Startup event you can find this in e.CommandLine. It is also found in My.Application.CommandLineArgs or Environment.GetCommandLineArgs.

  5. #5
    Johnson is offline VB.NET Forum Fanatic Johnson is on a distinguished programming path ahead
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Mar 2009
    Age
    20
    Posts
    134
    Reputation
    23

    Default

    This is very confusing

  6. #6
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,911
    Reputation
    670

    Default

    If your Reg entry says "MyApp.exe %1" then, when the user clicks MyFile.txt then Windows executes the commandline "MyApp.exe MyFile.txt" and, in your app, Environment.GetCommandLineArgs returns the array {"MyApp.exe", "MyFile.txt"}. Easy.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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