Prepare for your Next Interview
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?...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
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? |
| Sponsored Links |
|
|||
|
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 |
|
|||
|
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... |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| 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 |