开发者

Open multiple files using arguments

I'm using this code to load multiple files using windows context menu, but the problem is that the aplication is open many times as files the user has selected.

For example: If I select 14 files, an open them with the application, the aplicacion is opened 14 times and load the form only one.

But there is a way to send all arguments once? Because %1 send only one file, or there is for example a %2 that send all file pats in one argument? If there is I'vent found.

This my actual code:

Public Class Program

Public Shared Sub Main()

    Dim FurBase As New Core.clsDatabase

    FurBase.Directory = My.Application.Info.DirectoryPath

    Dim returnValue As String()

    returnValue = Environment.GetCommandLineArgs()
    If returnValue.Length > 1 Then

        FurBase.AddTemporalFilepath(returnValue(1).ToString)

    End If

    If Not Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length > 1 Then
        ShowUploader()
    End If

End Sub

Private Shared Sub ShowUploader()
    Dim Uploader As New frmUploader
    A开发者_如何学Gopplication.EnableVisualStyles()
    Application.Run(Uploader)
End Sub

End Class

Please tell me what think about the code and if ther is any way to improve it.

Regards~


I was reading about that today; seems you'll need to deal with a DDE server.

There are an old question which can help you: What is the best .net alternative to dde for file associations?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜