vfp9 force network machines to quit vfp9 programme

Posted on 2013-10-17
Medium Priority
Last Modified: 2013-11-02
Hi Experts
I have an application running on LAN and sometime at the close of the day some LAN machines are left running VFP9 application. I would like to quit programme on LAN machines  from Server before I turn the server off. I can provide the IP address of all LAN machines. Is there a way to force quit LAN machines from server through VFP9 programming.
Question by:b001
LVL 43

Accepted Solution

pcelba earned 1000 total points
ID: 39580736
Many ways to achieve this requirement exist.

1) Shared network table (easy and reliable enough)
Open given shared network table and check its record periodically in a timer which fires every minute. Timer code:
LOCAL lnWorkArea
lnWorkArea = SELECT(0)
USE d:\NetworkPath\SharedTable
IF ShutDownRq  
  DO AppExitProcedure
SELECT (m.lnWorkArea)

You may instantiate the Timer on the _screen:
_screen.AddObject('ShutDownTimer', 'MyTimer')
and the MyTimer class (with above Timer event) must be defined in your code or VCX library.

Once you replace the SharedTable.ShutDownRq field by .T. all running instances of your app will exit when their timer fire.

2) Public OLE object
You may define Public OLE class which contains Exit procedure in your app:
    *-- You may check the call validity here
    DO AppExitProcedure

And now you may call this class by CREATEOBJECT() or CREATEOBJECTEX() from any computer. This way requires a setup which is not trivial in some cases... More info: http://msdn.microsoft.com/en-us/library/ms917477.aspx

3) Network messaging
You may use Windows network functionality in VFP. It requires some ports open (and some donations...). More info: http://www.news2news.com/vfp/?example=410

Remember the fact if the client PC application becomes frozen the only way how to close all files is to force LAN PC disconnection from the server.
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1000 total points
ID: 39582345
If you have the needed privileges you could even shutdown the whole client/windows via:http://www.news2news.com/vfp/?example=122&function=-18

You can also simply disconnect the server from LAN to gain exclusive access to local files. The hard way is to restart the server.

Bye, Olaf.

PS: If it's about the EXE on the server, you shouldn't let users run the exe from there, because of problems with shared file usage. The EXE should be copied to clients before being run. It runs there anyway, no matter if they start it from their local or a mapped drive it runs on their client. A good idea would be to give them a link to a cmd using xcopy or robocopy for updating them and starting the copied EXE.

What remains is the need to get exclusive access to central dbfs, of course you don't copy them to local. One solution for that is like Pavel has given you, another is to disconnect when needed to update the database and a third of course is to move from dbfs to an sql server.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Are you in the migration process of your Exchange to Exchange Online? Be aware of customized solutions developed on the transport role on your old Exchange server. They might not be convertible to Exchange Online!
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question