this method does not use the window title. which is handy when your title changes. It uses what is called atoms.
** declare the windos api functions
declare integer GlobalAddAtom in win32api string
declare integer GlobalFindAtom in win32api string
declare integer GlobalDeleteAtom in win32api integer
* need a location to hold the atom for exiting. made public
* here, could be a property of a class.
public natom
** when creating a name for the atom it has nothing to do with the window name. so make the name anything.
** it is not case senstive abc = ABC
** if the atom exist from previous load it will return a
** positive number
if GlobalFindAtom('any name') > 0
quit
else
natom = GlobalAddAtom('any name') && create atom for the app
endif
I say use any name, but the name must be consistant. doing a find and add atom will be with the same name.
** at the end of the program just before exiting
** destroy the atom
GlobalDeleteAtom(natom)
it is importen to destroy the atom, for it is not automaticly destroyed on exit. which will mean that the program will not run again, untill the system is restarted.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.