Code to check another instance of program running works on XP but not on Vista

pragya

New member
Joined
May 29, 2007
Messages
3
Programming Experience
Beginner
Hi All i am facing an issue with Vista.
I have logged in as administrator also but the following line is generating an exception which was working correctly earlier in XP & 2000

" (Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) "

I know its due to the security features added by Vista because when I disable UAC in Vista its working perfectly.

Can anybody help me in this case

I am pasting the whole code

VB.NET:
Public Const gsResourceNamespace As String = "NBXCAS"

If gbMultipleAppInstances(gsResourceNamespace) Then
psErrorMessage = "Not allowed to have multiple instances of: " & gsApplicationDisplayName
Call mDisplayStartupError(psErrorMessage, MsgBoxStyle.ApplicationModal + MsgBoxStyle.Exclamation)
End
End If

Public Function gbMultipleAppInstances(ByVal vsWindowCaption As String) As Boolean

Return (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0)

End Function

Thanks ,
Pragya
 
Last edited by a moderator:
this might be a case where you may want to upgrade to VS2005 or VS2008, I know VS2005 has an option in the project's properties where you can have it as a single instance app

I'm pretty sure it would with the UAC thing turned on
 
Thanks !!!
The problem got solved by adding a manifest file with my application that allowed me to check process status...

Thanks for your suggestions I will try that also

Regards,
Pragya
 
Back
Top