07-03-2011, 01:48 PM
(07-03-2011, 03:30 AM)Ace Wrote:Code:If Not I.ProcessName = Application.ExecutablePath.Split("\")(Application.ExecutablePath.Split("\").Length - 1).Split(".")(0) Then
you didn't need all that extra typing lol. This could have been used as well:
As long as you Import the System.IO namespace, otherwise, you're going to have to put it directly in there like this:Code:Path.GetFileName(Application.ExecutablePath)
Code:IO.Path.GetFileName(Application.ExecutablePath)
Or you could have just split it at the last index of "\" instead, also it's only accurate for form applications. But it wouldn't work for a module or a service.
But this is only accurate for windows form applications (executables), and it wouldn't be very good to use for a service or a module.
Use this instead of the code above:
Code:Dim AppProcess As String = Process.GetCurrentProcess.MainModule.FileName
LOL... So what is it doing technically?... Explain please Ace