Web Program calls client program

Source: Internet
Author: User

A recent project to click on a link on the Web page to start their own program, but also to receive parameters, Google for 1.5 hours, finally the preliminary test passed.

Try Google: web Send message Windows Form, BS call CS program, custom Protocol ... Multiple keyword combinations to find this technique called

Registered URL protocol, in this article is described in more detail:

http://msdn.microsoft.com/en-us/library/aa767914 (v=vs.85). aspx

1) First write a test program:

usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacealert{classProgram {Static stringProcessInput (strings) {//TODO Verify and validate the input//string as appropriate for your application.       returns; }    Static voidMain (string[] args) {Console.WriteLine ("Alert.exe invoked with the following parameters.\r\n"); Console.WriteLine ("Raw command-line: \n\t"+environment.commandline); Console.WriteLine ("\n\narguments:\n"); foreach(stringSinchargs) {Console.WriteLine ("\ t"+ProcessInput (s)); } Console.WriteLine ("\npress any key to continue ...");    Console.readkey (); }  }}

I compiled the program into Edss.exe.

2) Edit a file with Notepad and rename it to Edss.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\EDSS]
@= "Url:edss Protocol"
"URL Protocol" = ""

[Hkey_classes_root\edss\defaulticon]
@= "\" D:\\alert\\edss.exe\ ""

[Hkey_classes_root\edss\shell]

[Hkey_classes_root\edss\shell\open]

[Hkey_classes_root\edss\shell\open\command]
@= "\" d:\\alert\\edss.exe\ "\"%1\ ""

After running Edss.reg, always prompt some registry entries to write unsuccessfully, tossing a half-day, looking at the definition of HTTP and other protocols, finally found to be 360 in interference.

Turn off 360 security guard, the registry finally write successfully!

It turned out to be 360 security guard. Prevents the last registry entry from being written to:

[Hkey_classes_root\edss\shell\open\command]
@= "\" d:\\alert\\edss.exe\ "\"%1\ ""

3) Enter Edss://hello,ie browser in IE to strike a security Warning window, confirm and start my application normally

4) After trying unsuccessfully in Chrome, it was found that in chrome it was not possible to enter Edss://hello directly to start, and an HTML page had to be written.

Immediately wrote a line of HTML page: <a href= ' Edss://hello ' > Start my Windows program </a>

Chrome can also start my Windows program!

Other browsers try again later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.