0

I want to subscribe to a custom URL protocol, eg. "pdf" meaning when specially crafted links like the below link are clicked, I get an event (windows launches my EXE passing the link args as command line args). I've done this once before in a VC++ app but can't remember how to do this for the life of me.

Eg link:

pdf://ANY ARGS

Clicking on the above link should launch my EXE with the command line args:

"ANY ARGS"

Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
  • possible duplicate of [how do I create my own URL protocol? (e.g. so://...)](http://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so) – CodeCaster Nov 11 '14 at 10:22

1 Answers1

0

This solved it for me. Answer by Erwinus.

This is the code for a .reg file, when run, registers the "pdf" protocol to launch "YourApp.exe"

REGEDIT4

[HKEY_CLASSES_ROOT\pdf]
@="URL:pdf Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\pdf\DefaultIcon]
@="\"C:\\Program Files\\YourApp\\YourApp.exe\""

[HKEY_CLASSES_ROOT\pdf\shell]

[HKEY_CLASSES_ROOT\pdf\shell\open]

[HKEY_CLASSES_ROOT\pdf\shell\open\command]
@="\"C:\\Program Files\\YourApp\\YourApp.exe\" \"%1\" \"%2\" \"%3\" \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\""
Community
  • 1
  • 1
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607