Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Running an application twice

Hi,
I would like to know how I can prevent the user from running the EXE file twice.
cause when I do run an EXE twice, I get an error telling me
 "address in use".
0
kukiya
Asked:
kukiya
  • 5
  • 5
1 Solution
 
kfyipCommented:
You can use "App.PrevInstance" to check whether an instance of the same application is running.
0
 
rovermCommented:
use this in your form_load event:

If App.PrevInstance Then
    MsgBox "Already started !!", vbCritical + vbOKOnly, "SOM"
    Unload Me
    End
End If

D'Mzzl!
RoverM
0
 
rovermCommented:
whoops, you can leave out "SOM" (the title of the msgbox).
kfyip: sorry, had the question open while building the example, didn't see you answer before I posted mine ;-) !

D'Mzzl
RoverM
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
kukiyaAuthor Commented:
Adjusted points to 10
0
 
kukiyaAuthor Commented:
It worked well when I add the "Unload"
thank you very very much!!!!!!
0
 
rovermCommented:
I know, using it also !
did you see that your q is in the 'waiting to be graded' section twice ?
I wonder if you have graded this one, the other will dissapear too !?

D'Mzzl!
RoverM
0
 
kukiyaAuthor Commented:
what do you mean by 'waiting to be graded' section twice '?
0
 
rovermCommented:
Take a look at the section PAQ, your question is appearing twice!
My question: why did you give kfyip the points while you wrote that 'It worked well when I add the "Unload" ', MY CODE!
<TEARS> ;-)

D'Mzzl!
RoverM
0
 
kukiyaAuthor Commented:
I'm sorry, I not very familier with the points buisness.
of course you should get points.
please tell me how I can reward you now.

now smile!!!!!!
0
 
rovermCommented:
No need to ! Just kidding! But to 'teach' you:

You can accept any comment as an answer by clicking the command button next to the comment-header.

D'Mzzl!
RoverM <LOL>
0
 
kukiyaAuthor Commented:
ok thank you very much!!!!!!
I'll use this from now on.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now