Geeks Talk

Prepare for your Next Interview




I want to open only one instance of an application

This is a discussion on I want to open only one instance of an application within the VB.NET forums, part of the Software Development category; Question asked by visitor Ramkumar I want to open only one instance of an application (.exe) in my Machine, what should i do?...


Go Back   Geeks Talk > Software Development > VB.NET

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-19-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 164 Times in 138 Posts
Geek_Guest is on a distinguished roadGeek_Guest is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-20-2007
Junior Member
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
monica15568 is on a distinguished road
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
Reply With Quote
  #3 (permalink)  
Old 12-26-2007
Junior Member
 
Join Date: Dec 2007
Location: india
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
nitin_padwal is on a distinguished road
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...
Reply With Quote
Reply

  Geeks Talk > Software Development > VB.NET


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Open defect count prasu Testing Templates 2 10-24-2007 08:46 AM
Difference between the two open SQL statements Geek_Guest SQL 0 03-12-2007 06:37 AM
Taking much time to open form in project instance.. JobHelper Oracle Apps 0 02-08-2007 02:43 PM
Cannot open registry key JobHelper Data Warehousing 0 01-09-2007 06:15 AM
Creating Server Instance and Configuration Lokesh M ASP.NET 0 06-28-2006 04:22 AM


All times are GMT -4. The time now is 12:57 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved