Problem setting up custom URL Protocol on Windows CE

522 views Asked by At

I am trying to setup a custom URL Protocol (testProtocol) on a Windows CE device. When the user clicks a link with testProtocol it will launch an application (ParamTest.exe).

I have done the following:

Created a Windows Smart Device Project -> Device Application.

I altered the Main() method to take in a string[] of arguments which will be passed along with the Protocol:

public static void Main(string[] args)
{ }

Since this is a test all that this application does is pass the args to a form which displays the arguments.

Next I've setup the following registry entries on the handset:

HKEY_LOCAL_MACHINE
  Software
    Microsoft
      Shell
        URLProtocols
          testProtocol

and

HKEY_CLASSES_ROOT
  testProtocol
    (Default) = "URL:Test Protocol"
    URL Protocol = ""
      Shell
        Open
          Command
            (Default) = "\Program Files\ParamTest\ParamTest.exe" "%1"

Whenever I navigate to testProtocol:12345 or testProtocol://54321 I get the following error:

"There is no application associated with "testProtocol:12345". Run the application first, then open this file from within the application."

I can run the application by navigating to \Program Files\ParamTest\ParamTest.exe. I made a cab file to install the file and make all registry entries, i've verified that these are correct using the CERegEditor tool.

Do have have to set a permission/mime-type/extra registry entry? Any help appreciated as this is driving me mad!

The OS version on the system i'm running the application on is 5.0.

1

There are 1 answers

0
Willem Hengeveld On

Not sure where your error is, from the layout of your registry settings, maybe your Shell subkey is one in the wrong position?

Here is how it works for me:

First creating the following registry keys and values:

[HKCR\testProtocol]
URL Protocol=""

[HKCR\testProtocol\Shell\Open\Command]
@=""\Program Files\ParamTest\ParamTest.exe" "%1""

[HKLM\software\microsoft\shell\urlprotocols\testProtocol]

Then creating a test html file:

<a href="testProtocol:12345">open 12345</a>

Then opening this file in internet explorer on my device, the ParamTest program is called with argument testprotocol:12345