using this function InterLockedExchangeadd (variable, interval)
For example :

InterLockedExchangeadd (im_Counter ,1 );