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

PCAnywhere & VFP OLE

Status
Not open for further replies.

fdc

IS-IT--Management
Dec 26, 2001
15
0
0
US
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 VFP code, 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.
Thanks to thread 595-169229 for getting me this far.

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\vfp500.dll'
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

 
Try to put 5 sec. of pause before traxfer.
You must destroy the connection object before 2nd try, and then create a new one.
 
I'm just starting to use OLE with PcAnywhere and found out that I needed to allow my process to finish before the code would continue. I thought about putting in a delay as in the previous post, but found that if I used a WHILE-WEND to check for a successful result that it solved the issue. While I am working with VB and am not sure of the use of these statements in VFP, this may apply to VFP and will allow you to do what you desire.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top