What I do
In my windows enviroment I am able to control this
if the program is running persistent. If it is, when the person clicks on the trigger for that program it simplys drops them back into the program. There are problems with this approach as you need to be sure that when you 'drop' into that program it shows on top of the stack. (Usually a problem when Outlook or Office is running.)
The way I do this is as follows:
1. I have a table with all the program-names with security access levels, so when a user hits a trigger it first looks at my SECURITYACCESS procedure for access rights and to check if this program is running or not. Remember, this only work for persistent programs.
Here is the code that checks that, (def vars have been left out.)
IF Z-Pro.RunPersistent = YES THEN DO: /*from the db table */
ASSIGN knockout = NO. /*Cant remember what this is for*/
IF z-pro.acc-lev <= nlss-per THEN DO: /*access level for user */
ASSIGN h_ProcedureHandle = SESSION:FIRST-PROCEDURE.
DO WHILE VALID-HANDLE(h_ProcedureHandle):
IF h_ProcedureHandle:FILE-NAME = Z-Pro.RndCmd THEN LEAVE.
ASSIGN h_ProcedureHandle = h_ProcedureHandle:NEXT-SIBLING.
END.
IF VALID-HANDLE(h_ProcedureHandle) THEN DO:
MESSAGE "This program is already running".
ASSIGN knockout = YES.
RUN ComeBack IN h_ProcedureHandle. /* takes you back */
END.
ELSE DO:
RUN VALUE(Z-Pro.RndCmd) PERSISTENT SET h_ProcedureHandle. /*program was not running, so now it can*/
END.
END.
ELSE DO:
MESSAGE "Sorry, you do not have the authority." view-as alert-box.
END.
END.
Hope this helps.
-Dennis-
Bennie H. said:
How can i avoid a user starting the same program more than once? Is there a parameter to check this or do I have to program this myself? Do you have a suggestion?
Many thanks, Bennie