Paul wrote: > No need to use a component I usually agree. But the danger in writing your own code is that you write it wrong. A component, we would hope, has been seen and used by more people, so it's more likely to be free of faults.
> in your dpr file, add all 'atom' lines > > var > RpAtom : integer; An Atom is a 16-bit type, not a 32-bit type, or whatever Integer happens to be defined as in the version of Delphi you compile this with. Better to use the type defined in Windows.pas for the return type of GlobalAddAtom. > Const > AtomName = 'MyAtom'; > > begin > if (GlobalFindAtom(AtomName) = 0) then > try > RpAtom:= GlobalAddAtom(AtomName); Here you have a race condition. Imagine two instances of the program running at the same time. Both check for the existing atom, both fail, both create the new atom, and both run thinking each is the only instance. This race condition only occurs while the program is starting up, but that's precisely the situation that the original poster was asking about. > Application.Initialize; > Application.CreateForm(TForm1, Form1); > Application.Run; > finally > GlobalDeleteAtom(RpAtom); > end; The global atom table is global to the entire system. If the program is already running once in one user's session, then no other users in other sessions may run the program. Named kernel objects (such as mutex objects) offer more flexibility. -- Rob _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

