An interesting question, asked days ago in one of our C++ forums, was the following:
A possible approach, based in mutex (mutual exclusion) objects, was posted a few hours later. In the proposed schema you declare a mutex object inside the MFC application class (i.e. the class header):
When you define the MFC application InitInstance() method, you attempt to create the mutex -whose creation will succeed the first time, fail afterward.-
About the else, the solution proponent (Bordon) said the following
The "SendMessage" is only needed if you want that the running application knows a 2nd instance was started. You send a registered windows message to your running application, and your running application will receive this message and knows that a 2nd instance was started. You can create i.e. code in your message handler to bring your app to the front.
Interesting. Was marked as solution by the original guy so it seems it worked. Would you have recommended another approach?
UPDATE: Please check in the comments section an entry posted by MS MFC expert Pat Brenner about this issue.