-
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
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