I have the following code to allow a single instance of my application.
VB Code:
  1. Dim process() As process
  2.  
  3.         process = System.Diagnostics.Process.GetProcessesByName("AppNameHere") 'System.Diagnostics.Process.GetCurrentProcess.ProcessName)
  4.         If process.Length = 1 Then 'Not already running
  5.             Return False
  6.         Else 'Already running
  7.             Return True
  8.         End If

My problem is that when the icon for the application is double clicked to launch, and then double clicked again to launch before anything has loaded - both attempts are caught as a multiple instance and nothing loads.

Is there a way to make this load the first instance and not allow any others even during the loading process?

I have also tried using a mutex to the same results.