give your app a CriticalSection, lets call it data:
CriticalSection data;
locking it is done by
data.Enter(); //enter the critical section
data.Leave(); //leave the critical section
CriticalSection::Lock __(data); //lock the critical section until destroyed eg create it at beginnin of a method and the whole method is secured for access
But i am not sure wether this helps you, because both apps have to use the same CriticalSection.