How can i test if a programm is alredy running?

mirekpa

New Member
Hi,
What you want to look ?
Locked reckord or tables, or other ...
If you needed new instans the *.r files, find this in memory delete and call new - of course if its possible.
Maybe you need own test environment.
M
 
Hi,
What you want to look ?
Locked reckord or tables, or other ...
If you needed new instans the *.r files, find this in memory delete and call new - of course if its possible.
Maybe you need own test environment.
M


i just want to check if the *.r programm is running at the moment
 

rstanciu

Member
4GL Progress is NOT a multi-thread environement is a procedural execution line by line.

If the program xxx.r is running, then you are in the execution of this program.

If you want to check where you are, add this in the "main" application.

ON F12 ANYWHERE DO:
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE plist AS CHARACTER FORMAT "x(70)".
FORM
plist
WITH FRAME what-prog OVERLAY ROW 10 CENTERED 5 DOWN NO-LABELS
TITLE " Program Trace ".
i = 2. /* Skip the current routine: PROGRAM-NAME(1) */
DO WHILE PROGRAM-NAME(i) <> ?:
IF i = 2
THEN plist = "Currently in : " + PROGRAM-NAME(i).
ELSE plist = "Which was called by: " + PROGRAM-NAME(i).

i = i + 1.
DISPLAY plist WITH FRAME what-prog.
DOWN WITH FRAME what-prog.
END.
PAUSE.
HIDE FRAME what-prog.
END.
 

mirekpa

New Member
ok i understand,
i not know accomplish solution,
IMHO you need catch the begin and end of procedure,
like count time execution

M
 

rstanciu

Member
If you try to debug, you can get more information by starting
your client _progres (prowin32) session using these parameters.

[Progress: v.10.x]

-clientlog clientlog.txt
-logginglevel 4
-logentrytypes DB.Connects,FileID,4GLMessages,4GLTrace,QryInfo
-clearlog
-logthreshold 1000000
-numlogfiles 3
-debugalert
-errorstack
-yc
-yx
-s 32
 

GregTomkins

Active Member
Besides PROGRAM-NAME to find out about programs in the current call stack, you can look at SESSION:FIRST-PROCEDURE to discover persistent procedures that are still running.

Or maybe you are talking about users that might be running a .r under a different process. I can't think of a simple way to know that. You'd have to have them write a record or hold a lock or something like that.
 

mirekpa

New Member
if you have own sources, inlude at the begin every procedure function methods write to record (table of user session, one per loged user, created when start delete when finished) at the end save it, you have who and whot and when executed, and how long time.
if original sources not yours that's difficulty.
 

Trist123

New Member
Using an API call you can check to see if a program is running.

in definitions add the following declaration

PROCEDURE FindWindowA EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER LpClassName AS LONG NO-UNDO.
DEFINE INPUT PARAMETER LpCaption AS CHARACTER NO-UNDO.
DEFINE RETURN PARAMETER LpHandle AS LONG NO-UNDO.
END PROCEDURE.

create a function that contains something like the following


DEFINE VARIABLE vinwindow AS INTEGER NO-UNDO.
DEFINE VARIABLE vchwindow AS CHARACTER NO-UNDO.

ASSIGN vchwindow = "my program name".
RUN FindWindowA (0,vchwindow, OUTPUT vinwindow).
IF vinwindow NE 0 THEN
RETURN FALSE.
ELSE
RETURN TRUE.
 
Top