瀏覽器-啟動本地程序
阿新 • • 發佈:2019-01-03
str 協議 com for ++ 地址欄 輸入 std main
(未完成)
使用自定義的協議打開應用程序
- 編寫程序
將test.exe保存到c盤根目錄
#include <stdio.h>
int main(int argc, char** argv)
{
int i;
printf("hello world!\n");
for (i = 0; i < argc; ++i)
{
printf("argv[%d] = %s\n", i, argv[i]);
}
getchar();
return 0;
}
- 註冊表裏添加協議
test.reg保存到c盤根目錄,並雙擊運行
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\test-url-protocol]
"URL Protocol"="c:\\test.exe"
@="fooProtocol"
[HKEY_CLASSES_ROOT\test-url-protocol\shell]
[HKEY_CLASSES_ROOT\test-url-protocol\shell\open]
[HKEY_CLASSES_ROOT\test-url-protocol\shell\open\command]
@="\"c:\\test.exe\" \"%1\""
- 瀏覽器中測試
瀏覽器地址欄輸入test-url-protocol://xxx
瀏覽器-啟動本地程序