INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

API Functions

one instance of program without use of WINDOW TITLE by danceman
Posted: 13 Sep 02 (Edited 21 Feb 03)

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.

quit foxpro

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close