Results 1 to 3 of 3

Thread: I want to open only one instance of an application

  1. #1
    Geek_Guest
    Guest

    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?


  2. #2
    Junior Member
    Join Date
    May 2006
    Answers
    4

    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


  3. #3
    Junior Member
    Join Date
    Dec 2007
    Answers
    12

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact