Click here to Skip to main content
15,886,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralObjects outside/free of the form Pin
codeinelogic6-Mar-08 5:43
codeinelogic6-Mar-08 5:43 
GeneralRe: Objects outside/free of the form Pin
led mike6-Mar-08 5:52
led mike6-Mar-08 5:52 
GeneralRe: Objects outside/free of the form Pin
CPallini6-Mar-08 5:52
mveCPallini6-Mar-08 5:52 
QuestionHow do I prevent multiple instances of my program Pin
cgb1436-Mar-08 5:28
cgb1436-Mar-08 5:28 
AnswerRe: How do I prevent multiple instances of my program Pin
Michael Schubert6-Mar-08 5:37
Michael Schubert6-Mar-08 5:37 
GeneralRe: How do I prevent multiple instances of my program Pin
cgb1436-Mar-08 5:59
cgb1436-Mar-08 5:59 
GeneralRe: How do I prevent multiple instances of my program Pin
Michael Schubert6-Mar-08 6:26
Michael Schubert6-Mar-08 6:26 
GeneralRe: How do I prevent multiple instances of my program Pin
Randor 6-Mar-08 7:16
professional Randor 6-Mar-08 7:16 
Michael,

Not everything Dr. Newcomer has written is correct in that article. He fails to mention the Global Local and Session namespace types of kernel objects.

http://msdn2.microsoft.com/en-us/library/aa382954(VS.85).aspx[^]

I find that some of his articles fail to address features of modern operating systems such as Vista and even some features of XP. If the goal of the original poster is to limit his application to an absolute single instance then the above code is perfectly sufficient by simply declaring the Mutex as global.

By adding a prefix of "Global\\" to the Mutex there is absolutely no way another instance of the application will be created. In addition, if you look at the bottom of the article by Dr. Newcomer he presents large functions to limit the application to session and global both of which can be achieved by simply prefixing the Mutex with "Global\\" , "Local\\" or "Session\\".

Conversely, if the goal of the original poster is to have maximum flexibility then perhaps the code Dr. Newcomer has presented would be better. Although I would personally modify it to use the kernel object namespaces.

Best Wishes,
-David Delaune
QuestionRe: How do I prevent multiple instances of my program Pin
David Crow19-Nov-09 3:26
David Crow19-Nov-09 3:26 
AnswerRe: How do I prevent multiple instances of my program Pin
Randor 19-Nov-09 4:41
professional Randor 19-Nov-09 4:41 
AnswerRe: How do I prevent multiple instances of my program Pin
Ernest Laurentin6-Mar-08 5:39
Ernest Laurentin6-Mar-08 5:39 
GeneralRe: How do I prevent multiple instances of my program Pin
cgb1436-Mar-08 6:01
cgb1436-Mar-08 6:01 
GeneralActiveX question Pin
dolphinhk6-Mar-08 5:04
dolphinhk6-Mar-08 5:04 
GeneralRe: ActiveX question Pin
led mike6-Mar-08 5:54
led mike6-Mar-08 5:54 
GeneralRe: ActiveX question Pin
Mark Salsbery6-Mar-08 6:23
Mark Salsbery6-Mar-08 6:23 
Generalhehehe well he did ask [modified] Pin
led mike6-Mar-08 9:06
led mike6-Mar-08 9:06 
GeneralRe: hehehe well he did ask Pin
Mark Salsbery6-Mar-08 9:14
Mark Salsbery6-Mar-08 9:14 
QuestionLoosing interfaces function in Single Instance Application with a Class having multiple heritance Pin
ochoteau6-Mar-08 5:00
ochoteau6-Mar-08 5:00 
GeneralRe: Loosing interfaces function in Single Instance Application with a Class having multiple heritance Pin
Member 75496024-Mar-08 10:50
Member 75496024-Mar-08 10:50 
GeneralRegistering a Notification Handler with an Active Directory Server. Pin
johnalek6-Mar-08 3:58
johnalek6-Mar-08 3:58 
QuestionWhat is cl_login in MFC? Pin
Nikesh Jagtap6-Mar-08 3:10
Nikesh Jagtap6-Mar-08 3:10 
AnswerRe: What is cl_login in MFC? Pin
Hamid_RT9-Mar-08 1:06
Hamid_RT9-Mar-08 1:06 
Generalmemory usage keeps on increasing Pin
jalsa G6-Mar-08 2:09
jalsa G6-Mar-08 2:09 
GeneralRe: memory usage keeps on increasing Pin
CPallini6-Mar-08 2:14
mveCPallini6-Mar-08 2:14 
GeneralRe: memory usage keeps on increasing Pin
toxcct6-Mar-08 2:18
toxcct6-Mar-08 2:18 

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.