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!

Setting up a com server

Status
Not open for further replies.

clarkrj

Programmer
May 12, 2002
49
0
0
GB
I need to setup a searchable stocklist on the web.

I have no problem in writing the code but I have no experience of using VFP as a com server.

Does anyone have the time to list out what is necessary in setting up a windows 2000 server to run the VFP.

Thank you
 
clarkrj

I'm not sure I understand what you need. A COM server is typically and application that is usable by either VFP or other application. The only difference is a COM VFP gets registered in the registry (so the other application can find it). And if you need to use it as an automated service, just put it in the task scheduler on Windows 2000 server and schedule it.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike

I would like to use VFP for searching the stocklist but what has to be "installed" onto the server, to allow the EXE's to run.

I intend to use ASP to call VFP with parameters to build the HTML pages.

 
Here's some steps for creating a simple com server.

Create testcom.prg containing code you want to run.
For example:
Code:
DEFINE CLASS testcomclass AS CUSTOM OLEPUBLIC
   NAME = "testcom"

   FUNCTION testmethod
      RETURN "*** It works!? ***"
      
   FUNCTION howdy
      RETURN " Howdy "
      
ENDDEFINE

Create a project named testcom and include testcom.prg
Build single threaded .DLL (testcom.dll)

From the command window:
!regsvr32 "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VFP98\testcom.dll"

oCom = createobject('testcom.testcomclass')
?oCom.TestMethod()
-or-
?oCom.howdy()

To unregister, !REGSVR32 /u "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VFP98\testcom.dll"

These are simple functions, but you can create what you need and call them with parameters. Just keep in mind that the com server itself can have NO screen i/o. Since it is a service, and not running on the screen any user interaction will cause it to lock up.

(I would add original author's credit but I don't know who it was. Sorry.)


-Dave S.-
[cheers]
Even more Fox stuff at:
 
I had intended to use ASP to call VFP to create the results file, then display the result in the browser.
 
These threads may give you some ideas:

Using ASP/HTML page to get XML data from fox database
thread184-619637

Using VFP 7.0 database on the web via ASP
thread184-546250

How do I return records from dll to asp???
thread184-604467

Also, check out this site:


-Dave S.-
[cheers]
Even more Fox stuff at:
 
DSummZZZ,

You explanation was very helpfull for me.
I´d like to know, how can I use the registered DLL inside others applications, like MSWORD, MSEXCEL. Can I do it ? What commnads should I use ?

[]´s
CCostaBR
 
Glad I could help out a little. But at this point, I'm going to step back and let someone more knowledgable in Word or Excel automation step in.
Basically, after you have built a COM server with VFP, any app that can utilize a COM server/control can access yours. But that isn't something I have done with any other apps save for VB.
In fact, you may get some good responses on using COM in the Excel or Word forums.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Thanks everyone for the help, I have been a bit busy recently & I havn't been able to come onto the forum as often as I would like

I now have a very good idea on what approach to take

Merry Xmas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top