-
I want to open only one instance of an application
Question asked by visitor Ramkumar
I want to open only one instance of an application (.exe) in my Machine, what should i do?
-
Junior Member
Re: I want to open only one instance of an application
In the main function of you application write the below code:-
public sub main()
dim pinstance as process = _ win32helper.getrunninginstance(process.getcurrentprocess().processname)
if not pinstance is nothing then
dim handle as intptr = pinstance.mainwindowhandle
else
'create new instance
end if
end sub
public shared function getrunninginstance(byval _ processname as string) as process
dim proclist() as process = _ process.getprocessesbyname(processname)
'if it is already running u will be returned with two processes
for each p as process in proclist
if p.id <> process.getcurrentprocess().id then
return p
end if
next
return nothing
end function
-
Junior Member
Re: I want to open only one instance of an application
i think there is a option provided my MS to restrict running the multiple instances of same application
probably u can find it in projects property...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules