[Windows Mobile]取得啟動應用程式的可執行檔路徑

  • 23342
  • 0
  • 2013-04-15

[Windows Mobile]取得啟動應用程式的可執行檔路徑

 

1. 問題描述

在 Windows Forms 應用程式,想要取得啟動應用程式的可執行檔路徑可以使用 Application.StartupPath

在 WIndows CE 或者 Windows Mobile 專案中,該如何取得

 

2. 方法

透過 Path.GetDirectoryName 方法 : 傳回指定路徑字串的目錄資訊。

VB.NET Code

Label1.Text = System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase.ToString)

C# Code


Label1.Text = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)); 

 

3. 參考

請問如何取得應用程式所在路徑