This function doesn’t seem to be working. Here’s the code that doesn’t work 
(it’s in the App.Open event):


#if TargetWindows
  winMutex = new WindowsMutexMBS
  winMutex.create "com.foo.appname.running"
  If winMutex.Lasterror <> 0 Then
    // app is already running
    dim thisApp as New ProcessMBS
    thisApp.GetCurrentProcess
    dim p as New ProcessMBS
    p.GetFirstProcess
    do
      If p.name = "appname.exe" Then
        If p.ProcessID <> thisApp.ProcessID Then
          dim ok as Boolean = RemoteControlMBS.WinBringProcessToTop(p.ProcessID)
          Quit
        End If
      End If
    loop until Not p.GetNextProcess
   End If
  #endif

Essentially, I’m checking to see if an instance of the application is already 
running, and if so, then quit this newly launched instance and bring the 
already running instance to the forefront.

Everything seems to be working as expected, i.e., comparing process IDs and the 
call to WinBringProcessToTop returns a result of True, but it does not bring 
the process to top, the app’s windows remain in the background behind other 
app’s windows.

Am I doing something wrong?

Is there another way to bring a process to the foreground?

_______________________________________________
mbsplugins@monkeybreadsoftware.info mailing list
%(list_address)s
https://ml-cgn08.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to