Click here to Skip to main content
15,886,661 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys, am in MFC project my task is to make mu application as a single instance using registry settings.

I want to know about how to store my application state in registry. if you know explain me.....

Thanks in advance
ganesh_IT
Posted

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Mar-11 3:23am    
Good sources, my 5. Also, please see my Answer.
--SA
Espen Harlinn 24-Mar-11 3:32am    
Perfect links, my 5
No! Do anything but not Registry for this purpose. I saw many bad methods, but this is the worst; I never head of such thing before. There are many civilized ways:

1) Use some IPC with unique name; the unique name can be the full path name of your executable.

1a) IPC: shared memory. This memory can also be used to put command line parameters from second instance to be passed to the first one.

1b) IPC: named pipes. The pipe transport can also be used to put command line parameters from second instance to be passed to the first one.

2) List all processes running is system. If the process of the same application is found, the running instance is the second one, to be terminated.

—SA
 
Share this answer
 
Comments
Espen Harlinn 24-Mar-11 3:32am    
Good advice, my 5
Sergey Alexandrovich Kryukov 24-Mar-11 3:36am    
Thank you, Espen.
How it's going?
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900