Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FPD 2.6a (.APP in lock)

Status
Not open for further replies.

Foxtech

Programmer
May 26, 2001
66
CA
Hi everyone,

I am searching the 3rd party software that allows to kill the session. Sometimes users forgot to quit the application and the DBFs are locked so I can not rename Myappl.app to update a new version.

An answer will be appreciate.

FoxTech...






 
Assuming that you can access the user's PC instead of looking for some 3rd party software, why don't you just use Windows' Task Manager?

If you are using PCAnywhere, just go to their Start | Run and type TaskMgr.exe You may have to also enter the path to the EXE file (such as: C:\WINDOWS or C:\WINDOWS\SYSTEM, etc.)

That should bring up the Task Manager and you can use it to kill the application. Note that sometimes it takes multiple times of clicking on the End Task button followed by an error message (keep trying, it will work) to get the Foxpro task to quit.

Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Let me elaborate a little on jrbbldr's post.
If you have access to their pc that way, you can probably exit the app gracefully. Killing the app can be most bad for data and index files. If you don't have access to their pc, the safest thing to do to get rid of the connection to your .app files is to clear their connection on the server.
On another note, you can use things like READKEY() and READ TIMEOUT to close the app after an extended period of time with no activity. Use READ TIMEOUT on say a data entry screen. After maybe 10 minutes of no activity, the timeout fires and returns them to the main menu. This could be a small app that does nothing but call your app. That way, your app wouldn't be locked. You can also create a flag file and check for its existence. If it's there, the app can automatically quit.
Dave S.
 
Hi Dave,

I think that your solution is good for checking the existence of a flag file and quit the program normally.
Can you explaine to me by writting a small Pseudo-code and tell me how to integrate that into my main program.

thanks a lot ...

Happy new year 2003.

 
I use a "read timeout" to get input. This is put into a "do while .T." loop
If I set the timeout to, for instance, 60 seconds, the system can run all sorts of things, one of which can be a tidy "quit" (I don't know the maximum for timeout).
readkey() returns 20 if the timeout was reached and 276 if a key was pressed.
I then have terminal specific files that I can check for to work out what to do.
if file ("thiscomp.txt")
do this
endif
if file ("thatcomp.txt")
do that
endif
This allows me to to trigger things specific to a particular terminal. I can have one shut down, another reindex, and another update simply by putting a file onto the HDD (easy with PCAnywhere for instance).
You can also use things like "if .not. between(time(),08:00:00","10:00:00")" to trigger things
Ken F
 
I use roughly the same methodology as tilltek. The only exception is that READKEY() returns different values if the data has been modified. Say if someone started editing a field, then walked away, READKEY() would return a 276. If no data has been changed, READKEY() returns a 20. These are both for a READ TIMEOUT. Now for regular data entry, READKEY() returns a 15 if the field(s) value(s) don't get changed, and a 271 if they do. Also, CTRL+Enter return different values, as well as TAB, etc. I say all this because you may want to handle edited screen shutdowns differently.
Anyway, put a DO WHILE in your main .prg, which calls other stuff. Check for a file, or even a flag in a field of a table.
Code:
*... MAIN.PRG
STORE .F. TO done
DO WHILE !done
   IF FILE("quit.txt")
      DO exitapp
   ELSE
      DO OtherApp.PRG
   ENDIF
ENDDO
QUIT


PROCEDURE exitapp
*... clean up code here
   done = .T.   
   CLOSE ALL
   CLEAR ALL
   
RETURN

*.... end of main.prg

*... OtherApp.PRG
STORE 600 TO nSeconds  &&... ten minutes
DO WHILE .....
   *... data entry code
   @ SAY ......
   @ GET ......
   READ TIMEOUT nSeconds    

   STORE READKEY() TO nKey
   DO CASE 
      CASE nKey = 20  &&... no change, timeout.  Safe to quit.

      CASE nKey = 276 &&... data changed, save? discard?

      OTHERWISE  &&... other keys pressed

   ENDCASE
ENDDO
*... end of OtherApp.prg
Of course, if you're using a generated screen, put the CASE in a snippet somewhere and add a timeout clause to the read and so on.
Dave S.
 
Hi Everyone,

I am using these commands in Main.prg

Activate menu MyMenu
Deactivate menu MyMenu

Please show me how to quit the program if there are no activities on the work station for a while.

system: server NT4.0
all clients : win98

thanks in advance
 
Since the app is basically in a wait state unless there is a read with a timeout clause, there isn't much you can do programmatically to make it close after a period of no activity. You would be better off making sure the tables are all closed when you are at a wait state.
Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top