簡體   English   中英

使用winform中的URI啟動應用程序

[英]Launching an application with an URI from winform

我有一個啟動默認程序的URI,我試圖弄清楚如何從Windows窗體應用程序啟動它。 Google上的所有結果都使用Windows Apps API來啟動URI,但我需要從表單中執行此操作。 如何才能做到這一點?

這是應用程序版本:

System.Uri uri = new System.Uri("myprotocl://10.0.0.123");
var success = await Windows.System.Launcher.LaunchUriAsync(uri);

假設您的計算機上已為“myprotocl”注冊了“處理程序”,則可以通過將uri指定為進程的文件名來啟動uri。

var url = "myprotocl://10.0.0.123";
var psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.FileName = url; 
Process.Start(psi);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM