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

VFP OLE

Status
Not open for further replies.

fdc

IS-IT--Management
Dec 26, 2001
15
US
Attempting to run PCAnywhere with VFP OLE.
I know it must be something simple, and some of you have already tried to help, but
still nothing seems to work.
Using the following test program, the first iteration of connect, xfer,xfer,run
cmd,disconnect works ONLY when running using debugger one instruction at a time.

By waiting for completion of Awremote functions all is OK. However, running
'normally' with autoyield = F or T programs fails to completely xfer files.

In NO case, does the 2nd connect work. Its as if link to AWREMOTE is gone after
disconnect. Is it OK to release the object and create again?

VFP 5.0, XP Home on both remote and host using Dial-up..
Thanks for any help........again.

* Start
clear
mtest = "c:\documents and settings\all users\application
data\symantec\pcanywhere\home.chf"
olet = createobject("awrem32.application")
*application.autoyield = .t.
do while .t.
*************************************************************
?'1st try'
=olet.awConnect(mtest)
?'Connect 1'
mret = olet.ConnectionStatus()
if mret < 1
?mtest+ 'No connect'
olet.awdisconnect()
exit
else
?'connect'
endif
?'xfer 1'
xsource = 'c:\laexe\lawl\vfpxxx.xxx'
xdest = 'c:\vfpxxx.xxx'
mret = ' '
mret = olet.filexfertohost(xdest,xsource)
if mret = .t.
?&quot;xfer OK&quot;
else
?mret+' no xfer 1'
endif
xsource = 'c:\xfer\lawlpict.bmp'
xdest = 'c:\xpic2.xxx'
mret = olet.filexfertohost(xdest,xsource)
if mret = .t.
?&quot;xfer OK&quot;
else
?mret+' no xfer 2'
endif
?'Exe cmd on host'
cmd = 'c:\lawl\rsup.exe'
mret = olet.executehostfile(cmd)
?mret
?'going to disconnect'
=olet.awdisconnect()
?'disconnect'
**************************************************************
?olet
?'2nd try'
=olet.awConnect(mtest)
?'Connect 1'
mret = olet.ConnectionStatus()
if mret < 1
?mtest+ 'No connect'
olet.awdisconnect()
exit
else
?'connect'
endif
?'xfer 1'
xsource = 'c:\xfer\lawlpict.bmp'
xdest = 'c:\'
mret = ''
mret = olet.filexfertohost(xdest,xsource)
if mret = .t.
?&quot;xfer OK&quot;
else
?mret+' no xfer 1'
endif
xsource = 'c:\lawl\compdep.prg'
xdest = 'c:\'
mret = olet.filexfertohost(xdest,xsource)
if mret = .t.
?&quot;xfer OK&quot;
else
?mret+' no xfer 2'
endif
?'Exe cmd on host'
cmd = 'c:\lawl\rsup.exe'
mret = olet.executehostfile(cmd)
?mret
?'going to disconnect'
=olet.awdisconnect()
?'disconnect'
exit
enddo
 
Are you explicitly setting Application.AutoYield = .f., or are you just commenting out the .t. portion? I ask because .T. is the default. Also, you probably need a DOEVENTS to keep the AW stuff ticking during the xfer.
Also, I don't see why releasing and recreating the AW object would be a problem with the second download. Give it a try. I haven't worked with AW so I'm not sure but there may be some default in the AWdisconnect() that releases the connection completely, rather than holds it open for another download. See if you can find some setting for another parameter in the docs.

Dave S.
 
Thanks Dave S for the prompt response. Autoyield was set explicitly. I will try DOEVENTS. Do I need after each OLE action?

 
Not after each event. DOEVENTS tells Windows to process other messages besides what you are doing in VFP. So anytime you need VFP to wait for something to finish in another process, you will need to use it.

Dave S.
 
This is almost correct.... Since Win98 (and was it so in Win95?) Windows IS pre-emptive multi tasking... that is, it WILL process other events outside of VFP whether you let it (using DOEVENTS) or not.

What DOEVENTS does is it lets VFP process windows events while VFP code is executing. eg. If you have a long loop and a form with a cancel button on it, the user can't click the cancel button till the loop is done (which is useless). However, if you include DOEVENTS in the loop, VFP can see the click on the cancel button and code can execute to properly cancel the loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top