Click here to Skip to main content
15,926,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to create another formview? Pin
steven_wong4-May-05 15:05
steven_wong4-May-05 15:05 
GeneralRe: how to create another formview? Pin
liquid_7-May-05 1:04
liquid_7-May-05 1:04 
GeneralRe: how to create another formview? Pin
steven_wong7-May-05 5:14
steven_wong7-May-05 5:14 
GeneralRestrict my application to one instance only Pin
Rajesh_K_Sharma3-May-05 21:19
Rajesh_K_Sharma3-May-05 21:19 
GeneralRe: Restrict my application to one instance only Pin
ThatsAlok3-May-05 21:33
ThatsAlok3-May-05 21:33 
GeneralRe: Restrict my application to one instance only Pin
Claudio Grazioli3-May-05 21:38
Claudio Grazioli3-May-05 21:38 
GeneralRe: Restrict my application to one instance only Pin
Aamir Butt4-May-05 0:58
Aamir Butt4-May-05 0:58 
GeneralRe: Restrict my application to one instance only Pin
Claudio Grazioli4-May-05 1:24
Claudio Grazioli4-May-05 1:24 
No, I don't mean something like this (well to be honest, I don't see from your example what your writing to the ini file). Because in this situation you still have the same problem: who deletes the information in the ini-file or in the registry, when your application crashes? After a crash, your information of "application is running" stays in the ini-file/registry forever and you won't be able to start your app again because it still thinks it is running.

The idea with the mutex is the following:
When you start your application, you first create a named mutex using something like CreateMutex(null, true, "anyuniquestring");. If this succeeds you get a handle to the mutex. Then you call GetLastError. If your application is not already running (so it's the first instance creating the named mutex) it will not return an error. But if there is already an instance running GetLastError will return ERROR_ALREADY_EXISTS. So this way you know, there is already an instance of your application running.


Claudio
Claudio's Website
Hommingberger Gepardenforelle
GeneralRe: Restrict my application to one instance only Pin
Aamir Butt4-May-05 19:08
Aamir Butt4-May-05 19:08 
GeneralRe: Restrict my application to one instance only Pin
David Crow4-May-05 3:31
David Crow4-May-05 3:31 
GeneralRe: Restrict my application to one instance only Pin
itkid4-May-05 20:54
itkid4-May-05 20:54 
GeneralMenu Pin
Anonymous3-May-05 20:48
Anonymous3-May-05 20:48 
GeneralRe: Menu Pin
ThomasABBE4-May-05 1:45
ThomasABBE4-May-05 1:45 
GeneralMultiple http-requests are stuck Pin
meremortal3-May-05 20:44
meremortal3-May-05 20:44 
GeneralRe: Multiple http-requests are stuck Pin
Ravi Bhavnani4-May-05 7:33
professionalRavi Bhavnani4-May-05 7:33 
GeneralRe: Multiple http-requests are stuck Pin
meremortal9-May-05 10:39
meremortal9-May-05 10:39 
GeneralRe: Multiple http-requests are stuck Pin
Ravi Bhavnani9-May-05 10:52
professionalRavi Bhavnani9-May-05 10:52 
GeneralRe: Multiple http-requests are stuck Pin
geo_m12-May-05 9:10
geo_m12-May-05 9:10 
GeneralRe: Multiple http-requests are stuck Pin
meremortal12-May-05 10:10
meremortal12-May-05 10:10 
GeneralRe: Multiple http-requests are stuck Pin
geo_m13-May-05 7:49
geo_m13-May-05 7:49 
GeneralJava Launcher Pin
vyjesh3-May-05 20:34
vyjesh3-May-05 20:34 
GeneralRe: Java Launcher Pin
S. Senthil Kumar3-May-05 20:37
S. Senthil Kumar3-May-05 20:37 
Generala question on heap..... Pin
namaskaaram3-May-05 20:14
namaskaaram3-May-05 20:14 
GeneralRe: a question on heap..... Pin
RYU^^3-May-05 20:34
RYU^^3-May-05 20:34 
GeneralRe: a question on heap..... Pin
Bob Stanneveld3-May-05 22:19
Bob Stanneveld3-May-05 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.