How to create an single instance of application using C++ programming, I don't know how to create an application using C++, but it would be great help if anybody would give any suggestion regarding it, do i need to create ActiveX control?
How to create an single instance of application using C++ programming, I don't know how to create an application using C++, but it would be great help if anybody would give any suggestion regarding it, do i need to create ActiveX control?
The project source contains a WinMain() function. WinMain() is the entry point for all Windows GUI applications. To solve the single instance application problem an approach would be to passes the new command line to the existing instance of the application. To write an single instance application you need to have C++Builder 4, or else you could develop an project Source in C++Builder 1 and 3.
I will give some hint regarding creating an application, when your c++ application loads, start your C# application by using WinExec or ShellExecute function.Your C# have to control BY ITSELF to prevent to run twice, using the single-instance trick (look at my first post).If you don't do this way, your C# could be ran twice by calling it outside the C++ aplication.
Making single-instance an application means enabling the application to recognize, at startup, The most known solutions are:
- Using a CMutex (a synchronization object global to the system).
- Using shared data sections.
The first parameter will be bool indicating that to activate the older instances of the class if need to call the second instance. The second parameter is an optional string, which specifies the name of the Mutex and window class, therefore either you don't need to specify the parameter, or pass NULL to it.
Bookmarks