BeginUnique (Set Application to Run in a Single Process)

Top  Previous  Next

 

BeginUnique( applicationname )

BeginUnique

Sets an application to run as a single process

applicationname

A string constant or variable that specifies name of your application. Example: ‘INVOICE.EXE’

BeginUnique returns FALSE if the program specified in applicationname is already running (active). If not running, BeginUnique returns an event number specified by Windows. This event number can be used by the EndUnique statement to terminate the single process mode.

To add this function to your existing applications, you need only include the CWUTIL.INC file in the Global Map section of your program:

INCLUDE('CWUTIL.INC'),ONCE

Return Data Type:     LONG

Example:

IF NOT BeginUnique(GLO:ApplicationName)

MESSAGE(CLIP(GLO:ApplicationName) & ' already running.')

RETURN

ELSE

RUN(GLO:ApplicationName)

END

 

See Also:

EndUnique