Edit in Project/View Source. Using Global atoms in Windows
Global Atom
By adding a global atom to the system, the global atom is maintained by the Windows system. It ensures that each atom is unique and manages its reference count, when the reference count of the global atom is 0, it is cleared from the memory. We use the globaladdatom function to add a string of less than 255 bytes to the global atom and use globalfindatom to check whether the global atom exists, at the end of the program, use the globaldeleteatom function to delete the added global atom. Example:
Program project1;
Uses Windows
Const
Iatom = 'singleapp ';
Begin
If globalfindatom (iatom) = 0 then
Begin
Globaladdatom (iatom );
Application. initialize;
Application. createform (tform1, form1 );
Application. Run;
Globaldeleteatom (globalfindatom (iatom ));
End
Else
MessageBox (0, 'you have run this project', '', mb_ OK );
End.