Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. restrict open multiple times on same application

restrict open multiple times on same application

Scheduled Pinned Locked Moved Visual Basic
tutorialhelpcsharp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PrakashBhaskar
    wrote on last edited by
    #1

    Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.

    Thanks Warm Regards Prakash-B

    S N R 3 Replies Last reply
    0
    • P PrakashBhaskar

      Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.

      Thanks Warm Regards Prakash-B

      S Offline
      S Offline
      SHatchard
      wrote on last edited by
      #2

      Hi You can iterate though the processes running on the machine to see if one is running with the same name as the current application. Code would look like Dim currentProcess as Process = Process.GetCurrentProcess Dim allProcesses as process() = process.getprocessesbyname(currentProcess.ProcessName) For each process as Process in allProcesses If process.Id = current.Id then continue for If [Assembly].GetExecutingAssembly().Location.Replace("/", "\") = currentProcess.MainModule.FileName Then 'There is another version running Throw new exception("Application already open") end if next Thats just entered but should give you a good idae of how to code this...

      1 Reply Last reply
      0
      • P PrakashBhaskar

        Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.

        Thanks Warm Regards Prakash-B

        N Offline
        N Offline
        NANCO
        wrote on last edited by
        #3

        run this on Form1_Load If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) = True Then End End If

        P 1 Reply Last reply
        0
        • P PrakashBhaskar

          Hi, I have created a windows application using VB.NET its working fine there is no issue on that applicaiton. My problem is i want to restrict multiple times of running the same application. for example if i click and run the exe file it will open the application again click on the same exe file it will open the same application second time. I want to restrict that if u click on the exe n time it should open one not many. is it possible if so can u plz guide me how to do that.

          Thanks Warm Regards Prakash-B

          R Offline
          R Offline
          Rupesh Kumar Swami
          wrote on last edited by
          #4

          hi, go to Properties of Project & click on application tab now click on checkBox related to "Make single instance application" hope this helps

          Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

          P 1 Reply Last reply
          0
          • R Rupesh Kumar Swami

            hi, go to Properties of Project & click on application tab now click on checkBox related to "Make single instance application" hope this helps

            Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

            P Offline
            P Offline
            PrakashBhaskar
            wrote on last edited by
            #5

            Thanks for your flying reply its working for me

            Thanks Warm Regards Prakash-B

            1 Reply Last reply
            0
            • N NANCO

              run this on Form1_Load If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) = True Then End End If

              P Offline
              P Offline
              PrakashBhaskar
              wrote on last edited by
              #6

              Thanks for your flying reply its working for me

              Thanks Warm Regards Prakash-B

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups