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!

COM object

Status
Not open for further replies.

FoxWing

Programmer
Dec 20, 2004
44
GB
I'm doing a project that my colleuge has written a window services that need to talk to my Foxpro application's fvp database. He suggested COM object to me.

I have no knowledge about developing COM object using Foxpro.

Can anyone point me a direction to start ? Is COM object the most easiet way to achieve this ?

thanks.
 

It depends what a "window services" means. Does it mean a webservice?

Mike Gagnon

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

Is COM object the most easiet way to achieve this ?

Possibly not. It depends on several factors, not least of which is the language that the application is written in and what tools are available.

Perhaps you could provide some more information about the requirements.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi Foxwing,

I agree that we need more info about this "window service" before providing good suggestions.

However, It is not hard to create a COM server in VFP, though, and I think that this is an easy way to access the VFP data from a typical "Windows Service".

Other options to you are the VFP OLE_DB data provider and the VFP ODBC data provider, or a C library (or other library appropriate to his developement platform) to directly access the .DBF files.


- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
If the main goal is a windows service, there is a tool called srvany that may make every exe (foxpro ar something else) to run as a windows service. Although it's recommended to use API calls to set something up as a service. See and look up the API calls in the MSDN for further details.

Bye, Olaf.
 
I just been told to be prepared to get my hand dirty about COM object. I do not have the complete picture what exactly i need to do yet.

Since because i know nothing about COM object, i posted this thread asking for direction to have a good start for beginner like it.

So far, I got a short article covering the basic of COM Server. Now, I'm stuck. Perhaps u aa can help me.

I have developed a COM object (dll). But, i have no idea how to call it. I wrote the codes below in com.prg


DEFINE CLASS Math AS SESSION OLEPUBLIC
FUNCTION Multiply(tnNum1, tnNum2)
LOCAL lnResult

lnResult = tnNum1 * tnNum2
RETURN lnResult
ENDFUNC
ENDDEFINE


How can i use it from my main applicattion (EXE) ?

Example shown :

ox = CREATEOBJECT("MyProject.Math")

But, what is MyProject mean ? The dll file name ?

 
Hi FoxWing,

so far quite right.

The default is the project name for the first part and the class name for the second part of "MyProject.OLEClass".

Take a look at the project info and go to the "Server" tab. There you'll see more info about the com servers of your project.

Also, when you compile the project, foxpro creates a TLB and VBR file. Take a look at the VBR file and search for lines defining the ProgID and VersionIndependantProgID. That's the important thing for Createobject...

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top