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

How to link a VB module in the background to FPW26 application? 1

Status
Not open for further replies.

phonesex

MIS
Sep 17, 2001
9
CA
Hello.

I read a response recently where "nigelgomm" describes running a VB app in the background to solve a problem identifying the OS and pssing the result to VFP 2.6

My question is: How is this done? I have a major task ahead of me and was about the translate many thousands of lines of Foxpro code to VB, but if I can figure out how to pass integers and strings between Foxpro for windows 2.6 (or could be vfoxpro 5 or 6) and VB 6 modules, I would save weeks worth of work.

Could someone kindly illustrate this for me?

Many thaks in advance.

Guido
 
continuation:

This is what I already know: VFP2.6 is a 16 bit application, so logically I should use vb4 16 bit version, right? Then there's something called DDE? Is that the mechanism to use? how?

Thanks for any input

Guido
 
I think you should consider a FPW 2.6a and VB 3.0 (or earlier) with DDE solution ONLY if you are still running Win 3.x. If you are running a current OS (e.g. Win 2000 SP4 or XP SP1), then you should move to VFP 8.0 and VB .NET and use COM or Sockets to communicate among the applications.

Rick
 
That's a valid point ... but I'm trying NOT to convert . I was planning to run this in a WIN98 environment. However, I found an activex driver that may work in vfp6 (I know, another forum) and eliminate my problem to begin with.

I just don't know

Guido
 
Hi,

You can use VB6 but not VB.Net.

In VB open up your form and set linkmode to 'source' and linktopic to the name of your form (e.g. mainform)

when a ddeinitiate is performed by a prog the sub form_linkopen is executed. When a ddeexecute is performed form_linkexecute is executed.

Private Sub Form_LinkExecute(CmdStr As String, Cancel As Integer)
if cmdstr = "Hello"
txtName.text = "message to pass back"
endif
end sub



in fpw26....

=ddesetoption("TIMEOUT",30*1000) // 30 sec timeout
tmpdde = ddeinitiate("myVBProj","Mainform") // already running ?
if tmpdde < 0
run /N myvbproj.exe
tmpdde = ddeinitiate(&quot;myVBProj&quot;,&quot;Mainform&quot;)
endif
if tmpdde < 0
=msg_box(&quot;ERROR: Cannot find myVBProj.exe&quot;)
return
endif
if ddeexecute(m.tmpdde,&quot;HELLO&quot;)
m.txt = dderequest(m.tmpdde,&quot;txtName&quot;)
else
m.txt = &quot;Error&quot;
endif


i have a VB6 server app that i call from a big fpw26 app for reading and setting the registry, running 32-bit OCXs/DLLs, OLE automation of MSWord and Excel - anything i can't do in fpw26. Performance is fine... not scalable for an enterprise component but for desktop it's great.
 
p.s.

DDE works fine with win95/98/me and win NT/2000/XP
i have about 500 copies of my fpw26 program out with customers on all sorts of PCs and have had no problems.

set visible and show in taskbar properties to false.

i agree with rgbean if you can convert to VFP8 it's probably worth it but ...
 
I tried it and it works great. The first time I call the vb module, there seems to be some delay (loading time?). Every other consecutive call responds instantly.

You've been a great help.

Guido
 
Guido,

yes, startup time. I tend to fire off the server executable when i start the fpw26 app and keep it running in the background.

glad to be of help

Nigel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top