Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Won't run external exe at runtime, does in IDE
Message
From
12/10/2018 04:09:51
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Won't run external exe at runtime, does in IDE
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01662565
Message ID:
01662565
Views:
60
I'm working on a little app which has to connect somewhere, retrieve data, write into database if any updates are detected, exit. Now to connect it needs certain credentials which are provided by a dot net dll supplied by them.

Tried to look into how to call a dot net dll from fox, gave up. All that interop is involving COM or that you write the dll yourself, not third party. And even then it's just too complicated for this little thing. So I had a colleague compile a little exe which would simply emit the credentials to stdout. I then just run the exe and grab the results into a text file, filetostring() it, parse and I have my credentials and can move on.

And that works swimmingly when I build an exe which calls that exe (via a batch file with full paths for everything, using api_apprun but also using simple run command) from VFP IDE. When I run it directly from explorer, it never detects that this dotnet exe has exited and stays so. Or it hangs afterwards (when api_apprun) or exits (when run command).

... and thanks, auntie Emma, found it. It was the filestostr() which was issued immediately, before the OS had the time to close it. Added one second wait and now it works. It seems that while Fox is single threaded, it still may launch a process in a separate thread, and it may not be quite finished when it says it is.

Also, using api_apprun seems to get it stuck, still, but simple run command goes.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Next
Reply
Map
View

Click here to load this message in the networking platform