Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unable to use WinExec
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00092940
Message ID:
00093054
Views:
37
>It might be a problem with VFP running the same program twice in the same folder, like trying to use foxuser.dbf exclusive in both instances.
>
>Can you from a desktop shortcut launch the EXE twice without it choking on the second?

Yes.

>Why would the EXE want to spawn itself again? Maybe you need a seperate controller program that is responsible for launching the multiple instances of the app.

The program I wrote needs to run all the time. Every 24 hours it needs to shutdown and reinitialize itself. Since I do not want to start it everyday manually, I thought I could use WinExec, CreateProcess, or ShellExecute to launch to program again before it dies.

Since it seems like I can do it this way, it looks like I need a controller program (like you have said) to do this. I was trying something like this:

DO WHILE MoreToDo
CreateProcess(...)
WaitForSingleObject(Process ID, -1)
CloseHandle(Process ID)
CloseHandle(Thread ID)
ENDDO

When I tried this, it locked up FoxPro.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform