First, update the registration form
Windows Registry Editor Version 5.00[hkey_classes_root\receiveoutofarg] "URL Protocol" = "d:\\longhaibin\\learn\\net\\ Receiveoutofarg\\receiveoutofarg\\bin\\debug\\receiveoutofarg.exe "@=" ApplicationName "[HKEY_CLASSES_ROOT\ Receiveoutofarg\defaulticon]@= "d:\\longhaibin\\learn\\net\\receiveoutofarg\\receiveoutofarg\\bin\\debug\\ receiveoutofarg.exe,1 "[hkey_classes_root\receiveoutofarg\shell][hkey_classes_root\receiveoutofarg\shell\open][ Hkey_classes_root\receiveoutofarg13:14 2017/5/11\shell\open\command]@= "\" d:\\longhaibin\\learn\\net\\ Receiveoutofarg\\receiveoutofarg\\bin\\debug\\receiveoutofarg.exe\ "\"%1\ ""
Description
- ApplicationName: Indicates the name of the prompt when the Web page opens
- '%1 ': represents the parameter to be passed, just%1,\ ": Represents an escape character
Second, create an application
Here's the code for the C # application: Entry location:
Static class program{ //<summary>/// The main entry point of the application. /// </summary> [STAThread] staticvoid Main (string[] args) { application.enablevisualstyles (); Application.setcompatibletextrenderingdefault (false); Application.Run (new Form1 (args));} }
Form code:
Public Partial classform1:form{Private string[] args; PublicForm1 (string[] args) { This. args =args; InitializeComponent (); } Private voidForm1_Load (Objectsender, EventArgs e) { This. Label1. Text =string. Join (",", This. args); }}Third, create a Web page
Web pages can be called with a tag:
<href= "RECEIVEOUTOFARG://ABC">open</A >
Common Web page Invoke native application scenario (Windows platform)