CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2012
    Posts
    2

    [RESOLVED] activating shortcuts with a custom protocol handler

    I'm working on a project to run putty when a website button is pressed. One of the requirements is that putty starts maximized. I'm doing this with a custom protocol handler that activates a shortcut that runs putty. The shortcut is necessary to enable maximization. How do I configure the registry entry for the protocol handler to activate a shortcut. Here is the registry key to point directly at putty (works):

    [HKEY_CLASSES_ROOT\protocol1\shell\open\command]
    @="\"C:\\Program Files\\Path\\PuTTY\\putty.exe\" \"\"-load session-1\"\""

    I can create a shortcut pointing to putty and supplying it with the necessary arguments, which works beautifully either by double-clicking or running from CMD. However, if I point the registry entry at the shortcut:

    [HKEY_CLASSES_ROOT\protocol\shell\open\command]
    @="\"C:\\Program Files\\Path\\PuTTY\\SHORTCUT.lnk\""

    I get an error message:
    "Unable to open this helper application for protocol1:somedummytext..."

    I can also attack this by running the following command in cmd:

    start /MAX "" "C:\Program Files\Path\PuTTY\PuTTY.exe" -load session-1

    However, I cannot figure out how to modify it for use in the protocol handler registry entry. Registry entries can be sensitive to quotes, so I may need to use some fancy quoting to make this work.

    Thoughts?

  2. #2
    Join Date
    Jun 2012
    Posts
    2

    Re: activating shortcuts with a custom protocol handler

    Apparently, a protocol handler can point to a batch file, so I ended up using the latter method. A bit inelegant, though. I would expect consistent (or at least documented) behavior across the methods to call a program with arguments.

Tags for this Thread

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