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

OLEPUBLIC Class and INIT parameters 2

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
US
Hello All,

I'm writing a server and I do not seem to be able to pass parameters to my OLEPUBLIC class(s) INIT event.

The INIT event fires when the object is created but the parameters are ignored.

FOR EXAMPLE
cPath = "C:\temp\test\"
oTest = CREATEOBJECT('servertool.autoseq',cPath)

DEFINE CLASS AutoSeq AS CUSTOM OLEPUBLIC
...
PROCEDURE INIT
LPARAMETERS cPath
MESSAGEBOX(TYPE('cPath'),"test parameters")
...
ENDEFINE

The messagebox displays the parameter cPath as type Logical. Why?

-Pete
 
Pete, COM object's Init method fired nt by VFP, but by self. This means that your application cannot pass parameters to the Init method of the COM object, just because VFP application does not calls it. It is called automatically inside of the COM object EXE or DLL during CREATEOBJECT command. COM objects are completely separate modules. Thay even could run on the remote server using CREATEOBJECTEX command. Passing parameters to INIT in such case might be a great problem for MS developers of VFP.

To pass parameters to the COM object, really you need to do little inside of Init. Make a separate method (say, 'InitCOMObject') and call it just after CREATEOBJECT with parameters. Put your custom initialization code there.
Ideally, you can have Initialization routine for COM object where you put all this and call in all places where you need.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Thanks Vlad, I'll creat another init method.

One qustion, my EXE object is remote. When I use the SYS(5)+CURDIR() it returns the location of app, not the EXE object. I have tables at the same location as my EXE object, but the object can't find them bu itself.

Do you know anyway for the EXEobject to know where it is relative to the app? The EXEobect is registered should I go that route?
-Pete
 
Hi Pete,

In your server's init method, include:

THIS.icServerDir = JUSTPATH(APPLICATION.ServerName) Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top