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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running an asynchronous process within VFP

Status
Not open for further replies.

rkolva

Programmer
Jan 16, 2003
127
US
Hello all,

I've got a data entry system that transmits data as xml over http ssl with a client certificate. The handshake takes about a second on average and while the data is being sent I display a graphic that lets the user know something is happening. The communication is currently in a custom class that I'm in the process to converting it to a COM dll so that I don't have to include the code with each of my applications (exes) as I typically have more than 1 of my apps running on a given machine. What I would like to do is to initiate the communication process asynchronously so that the user doesn't see a 'hiccup' in using the app. I suppose I could shell the communication to an exe. Any suggestions on a good approach?

Thanks to all.

Ralph
 
Using a seperate exe or a dll should work fine. I would think it would work just like calling a procedure in that you pass paramters either using a shellexecute() or automation.

You might want to leave a file somewhere that the main program can check for using a timer to see if the transfer failed or not so that it can tell the user.

Brian
 
Thanks for the quick response Brian.

Currently I assign my application object an instance of my communication object which has a failed transmission flag and cache the xml to a flat file it communication fails. In a sence the flat file also acts as a flag, if its empty it worked. If using an exe I suppose it would be better to use a seperate transaction file for each app and pass the file location as an arg.

If I were to use automation how do I make the call telling it launch as an independant process, or does that happen by default or a setting?

Ralph
 
Ralph,
If you create a VFP .DLL COM server, then you can "automate" it just like any other COM server - see the many examples posted on Tek-Tips - especially those for Outlook, Excel and Word. The only difference, is that you can decide what properties and methods you want to expose in your "server". Note: COM DLLs can't have any UI displays, if you need that capability, then it'll hace to be a .EXE COM server!

I believe there may even be a FAQ on writing a COM server, but if you can't find it, a little program can easily show the concepts.

Rick
 
Thanks Rick,

Currently my class doesn't have any UI and I don't expect that I'll ever want to give it one, so the DLL sounds like it'll do the trick. I started to port the class from an 'ActiveDoc' to 'Session' (as suggested in 'MegaFox') and got a successful first compile on a laptop machine but on my main development machine it doesn't want to write to the registry properly. I'll take a look at the FAQ.

Thanks for the input. I always find this site a fantastic source of info and input and the contributing programmers top notch. You all are a great bunch of folk!

Thanks again.

Ralph

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top