1
在表單加載上,您可以從Environment.CommandLine
檢索整個命令字符串。但是,當我使用應用程序事件來檢測命令行字符串時,我的單個實例應用程序再次打開,我找不到相當於Environment.CommandLine
在StartupNextInstanceEventArgs
。VB.NET等效於(StartupNextInstanceEventArgs)中的Environment.CommandLine
這裏是我的代碼:
Private Sub MyApplication_StartupNextInstance(_
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs _
) Handles Me.StartupNextInstance
'I can only use e.CommandLine which returns a readonlycollection, not a string like Environment.CommandLine does. Can someone help me out?
End Sub
只需使用'昏暗CMD =的string.join(」」,e.CommandLine.ToArray)' –