Click here to Skip to main content
13,000,982 members (58,855 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Recently, I get a problem in one of my Win32 applications. The application calls CreateEvent with a unique string, to determain whether another instance of the application is already running. Then the application exits if the call’s GetLastError() == ERROR_ALREADY_EXISTS. It works as expected in most computers. But when it is running in virtual box, it does not work. And when I use CreateMutex, it works again. Can anyone tell me Why the ‘CreateEvent’ does not work while the ‘CreateMutex’ does
Posted 8-Jan-13 22:08pm
Updated 8-Jan-13 22:10pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

A very thorough treatment of the whole subject can be found here[^] in an article by Jeff Prosise (who I have a great deal of respect for). The article is a bit old but the answers are still relevant.

If you are using VS2008 or greater, you can apparently go to the project properties and check the box "Make single instance application" (I haven't tried it but it is described here[^]).
Member 7857575 15-Jan-13 0:35am
Thank you Mr Brydon
It’s my great honor to receive your reply. especially the message is from the other side of the world.

I read the articles you mentioned above, but I cannot find the "Make single instance application" option (maybe it applies only in VB). The first article is great.

Although I still don’t know why ‘CreateEvent’ doesn’t work. But it is not particularly important. After all it’s in virtualbox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100