This is a piece of one of my servers. "IonFilipski-db2orb-v3-server" is just a name for a segment which could be any other names. The segment with this name is shared and variables inside it are accessible to any applications using this segment. If the flag isRunningAlready is true, show server window and exit application. So will be shown only the first instance of application. You should add explicitly /section:IonFilipski-db2orb-v3-server,rws to the linker. RWS means read/write/shared.
I had to do the same thing. I chose to use a CMutex instead. If you do use the CMutex route, you will need an Enum Windows proc to find your windows and a message handler to return the HWND. With Ion's way, the data_seg is system wide and the only problem I could see with it is the rare case that the app is launched twice before either sets the data_seg members. I say go the easy way with Ion's post but keep the mutex in mind just incase
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.