Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running separate process
Message
From
01/12/2020 05:36:02
 
 
To
01/12/2020 05:24:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677343
Message ID:
01677352
Views:
55
>>>>>>I created a small executable to run a process in the background, so the application does not hang while the process is executed. A timer then checks for the file created and shows the result. I did not use ParallelFox, because I did not want to register any additional libraries at the clients, but not sure if I can succeed.
>>>>>>
>>>>>>Because there is one small problem: When starting the process (using api_Apprun with "HID") the main application loses its focus for a short time. That can be annoying when you are typing or doing anything, and then for a split second the focus goes away, and that every few minutes. So I wonder if there is a way to run the process without losing focus of the calling application, or if there is a way to use ParallelFox without registering, or perhaps another idea?
>>>>>
>>>>>You can run the process as a service. Or like I used to do, run it on a server or a separate machine. All "communication" with the process is done by sending a file with "instructions", and the process responds by creating a file with the "answers".
>>>>
>>>>Yes that could be an idea. So the process stays active in the background and waits for instructions. Only problem, it needs to quit when I close the main application. Of course it was easier to create it in such a way to start it with a parameter, run the process, and then quit, but your solution might be the next best thing and solves the original issue.
>>>
>>>One of the instructions sent via the file, can be to shut itself down.
>>
>>You are a genius !
>
>Tentative disagree - with sending kill command also via file, not on Tore being smart!
>Whenever your main process runs into bad errors like C0000... chances are your kill command will not be sent.

That is true, although it would not cause any real issues if the process would have stayed alive by mistake, and those errors are relatively rare.

>So the basic message has to be "main process still alive" - easy to handle with a .dbf used by both and main process holding a lock on a certain record. Main process dies, lock evaporates, system process realizes that on next check and terminates itself..

File lock is a good way, otherwise I would have checked in the process if the result has been picked up since the last call, so that would not have been a big problem in this case.

>Although for me it is not clear why you cannot compile the "system" part as COM exe and run out of process with a COM communication directly betwenn both processes, as your description does not point to load balancing or work distribution, only as wish to use another Thread and Core.

Indeed I could create a com exe, but would it not just instantiate the class and run in the same thread? Or how else should I call the method?
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform