Appliction instances synchronization

I wanna know how to synchronize some instances of my application. Imagine that apllication reads ini-file, prepare GUI controls and waits for user action. Second/third application instance can edit ini-file so first instance can interprets ini-file in non correct way. So the question is how to send notification from one instance and how to recieve that message in another instances.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think, best way is using Syncronization metod Mutex
with Api CreateMutex,OpenMutex,
ReleaseMutex. I use this metod
for test existance of same instance,
you can test open some file:
say CreateMutex(and test by opened) befor open , and ReleaseMutex after close.
I hope, it helps. Alex.
BTWE: If you want i can send you my code (tomorrow).

AVaulinAuthor Commented:
I'll wait for tomorrow. But I'm know all (or almost all) about Mutex functions. I want to notify and recieve notification at run-time. Read question more carefull. Waiting for tomorrow (or for your code)...
>>I'm know all (or almost all) about Mutex
so , you don't need my code, but:

  HANDLE hMutex = CreateMutex(NULL,TRUE, "wkadip_mutex");
  if (hMutex)//real one? MUTEX_ALL_ACCESS
      if (GetLastError() != ERROR_ALREADY_EXISTS)
2. For  
>>can interprets ini-file in non correct way
You can simple use LockFile Api!
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

AVaulinAuthor Commented:
Sorry, I can't accept this answer. I don't want lock file. I want to know if one instance changed it. Other words: imagine dialog-based application with only one check-box control. You can run more than one instances. Check-box state changing in one instance must chagne state in all another. How can I do that?
What you want is communication between processes. ("communication over Process boundaries").

This can be done in several ways:
1. win32 messages:
You define a message
#define WM_MYMESS WM_USER + 1

Then you SendMessage(...) it, with an instance number. (Either the windows instance or some instance number you supply.)

And in the messageloop you add a

2. Use Pipes.
a. This is similar to opening a shared file, except that whoever opens pipe get's immediate notification that file changed.
You will write into the pipe (file) a number (0 = no-one changed anything, 1 = instance 1 changed, 2 = etc.)
b. Or use named pipes:
Have a pipe for each instance open (not trivial) with instance number in name.

3. Use winsock.
Make a server (external to your instances, or in a thread of the first instance) and the others write to the server with a number and are notified by the server.

As you see, the easiest and fastest is win32 messages, except for a few drawbacks.
 Enjoy,  Moshe

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
When receiving the WM_COMMAND with BN_CLICKED notification for the first control , send the second window a message ( or Set an event that will release a thread waiting ) to change the check box .
AVaulinAuthor Commented:
This is not an answer I waited for. But it gave me a start point to find answer by meself.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.