Do anyone have a sample for write a OLE Object?
I need to create a object call by VBSCRIPT to display a report in client
side.

Thanks
Kervin

Re: VFP OLE Object by Zeke

Zeke
Thu Jul 01 03:29:15 CDT 2004

It's quite easy. Basically you create a project with a main prg in. The prg
should have a class declared as olepublic. In the class you put properties
and functions. Internal functions should be defined as hidden.

Define Class 'myclass' As Custom OlePublic
hidden prop1, prop2, prop3...
hidden function myfunc1
lparameters lp1, lp2
endfunc
function myfunc2
lparameters lp1, lp2
endfunc
enddefine

You build a DLL, e.g. mydll.dll , and Foxpro registers it automatically.
Then you can test run it in Foxpro:
ox = createobject('mydll.myclass')
? ox.myfunc(1,2)

OK?







"Kervin Lo" <kwlo@siksikyuen.org.hk> wrote in message
news:%23zQNPL0XEHA.2364@TK2MSFTNGP12.phx.gbl...
> Do anyone have a sample for write a OLE Object?
> I need to create a object call by VBSCRIPT to display a report in client
> side.
>
> Thanks
> Kervin
>
>



Re: VFP OLE Object by Zeke

Zeke
Thu Jul 01 04:07:24 CDT 2004

Forgot to mention, that you need to compile to an EXE instead of DLL if you
want to use the preview function of Foxpro's report generator, since a DLL
cannot display a user interface.
Zeke

"Zeke Galama" <remove_galama_remove@telia.com> wrote in message
news:%23a1d7V0XEHA.3100@TK2MSFTNGP09.phx.gbl...
> It's quite easy. Basically you create a project with a main prg in. The
prg
> should have a class declared as olepublic. In the class you put properties
> and functions. Internal functions should be defined as hidden.
>
> Define Class 'myclass' As Custom OlePublic
> hidden prop1, prop2, prop3...
> hidden function myfunc1
> lparameters lp1, lp2
> endfunc
> function myfunc2
> lparameters lp1, lp2
> endfunc
> enddefine
>
> You build a DLL, e.g. mydll.dll , and Foxpro registers it automatically.
> Then you can test run it in Foxpro:
> ox = createobject('mydll.myclass')
> ? ox.myfunc(1,2)
>
> OK?
>
>
>
>
>
>
>
> "Kervin Lo" <kwlo@siksikyuen.org.hk> wrote in message
> news:%23zQNPL0XEHA.2364@TK2MSFTNGP12.phx.gbl...
> > Do anyone have a sample for write a OLE Object?
> > I need to create a object call by VBSCRIPT to display a report in client
> > side.
> >
> > Thanks
> > Kervin
> >
> >
>
>



Re: VFP OLE Object by Alex

Alex
Thu Jul 01 04:47:28 CDT 2004

On Thu, 1 Jul 2004 16:09:34 +0800, "Kervin Lo"
<kwlo@siksikyuen.org.hk> wrote:

>Do anyone have a sample for write a OLE Object?
>I need to create a object call by VBSCRIPT to display a report in client
>side.


Kervin

It all depends on what you generically call an "ole object".

If you mean an ActiveX control. No. VFP cannot create ActiveX
controls. Can read them, can subclass and modify them but cannot
create them.

If what you mean is a COM object, then it is fairly easy using the
OLEPUBLIC modifier.

See examples in the Fox Wiki:
http://fox.wikis.com/wc.dll?Wiki~COMComponentExample

Your message is not very clar on what you need to do. Do you mean you
plan to use VBS in an ASP page to display a Fox report (FRX)?

You cannot display an FRX outside of VFP as the non-VFP client does
not understand the format. What is normally done in those cases is
onverting it to another format. The most common is by printing it to a
PDF writer and exporting it (or sending it through HTTP to a browser)
as PDF.

HTH




Alex Feldstein
________________________________
Microsoft Visual FoxPro MVP
Please respond in the public groups so that everybody
can benefit from the exchange.
Favor de responder en los foros públicos asi todos se benefician.
(Address scrambled with ROT-13)

Re: VFP OLE Object by Kervin

Kervin
Thu Jul 01 08:18:25 CDT 2004

Hi, all

I have tried like that

DEFINE CLASS cPerson AS Custom OLEPUBLIC
test=SPACE(10)
PROCEDURE Init
this.test="start"
ENDPROC

FUNCTION FullName
RETURN this.test
ENDPROC

ENDDEFINE

Then Compile to comdata.dll, and try the follow code, but it prompt
"COMDATA.CPERSON" not found,

a=CREATEOBJECT("comdata.cPerson")
? a.test
? a.FullName()
a.release

I tried to Compile the DLL name same as the project name, it can
createobject successful, but it cannot find the "a.test".
I don't know why, I am using VFP8

BTW, I compiled to a exe, but it is not allow to regsvr32, it prompt not
entry point.

Thanks
Kervin



Re: VFP OLE Object by Kervin

Kervin
Thu Jul 01 08:22:17 CDT 2004

Hi, all

I have tried like that

DEFINE CLASS cPerson AS Custom OLEPUBLIC
test=SPACE(10)
PROCEDURE Init
this.test="start"
ENDPROC

FUNCTION FullName
RETURN this.test
ENDPROC

ENDDEFINE

Then Compile to comdata.dll, and try the follow code, but it prompt
"COMDATA.CPERSON" not found,

a=CREATEOBJECT("comdata.cPerson")
? a.test
? a.FullName()
a.release

I tried to Compile the DLL name same as the project name, it can
createobject successful, but it cannot find the "a.test".
I don't know why, I am using VFP8

BTW, I compiled to a exe, but it is not allow to regsvr32, it prompt not
entry point.

Thanks
Kervin


"Alex Feldstein" <nyrks@Kzicf.bet>
???????:utm7e0ppiftavr0kuhugi6u5e2n5kmb6nt@4ax.com...
> On Thu, 1 Jul 2004 16:09:34 +0800, "Kervin Lo"
> <kwlo@siksikyuen.org.hk> wrote:
>
> >Do anyone have a sample for write a OLE Object?
> >I need to create a object call by VBSCRIPT to display a report in client
> >side.
>
>
> Kervin
>
> It all depends on what you generically call an "ole object".
>
> If you mean an ActiveX control. No. VFP cannot create ActiveX
> controls. Can read them, can subclass and modify them but cannot
> create them.
>
> If what you mean is a COM object, then it is fairly easy using the
> OLEPUBLIC modifier.
>
> See examples in the Fox Wiki:
> http://fox.wikis.com/wc.dll?Wiki~COMComponentExample
>
> Your message is not very clar on what you need to do. Do you mean you
> plan to use VBS in an ASP page to display a Fox report (FRX)?
>
> You cannot display an FRX outside of VFP as the non-VFP client does
> not understand the format. What is normally done in those cases is
> onverting it to another format. The most common is by printing it to a
> PDF writer and exporting it (or sending it through HTTP to a browser)
> as PDF.
>
> HTH
>
>
>
>
> Alex Feldstein
> ________________________________
> Microsoft Visual FoxPro MVP
> Please respond in the public groups so that everybody
> can benefit from the exchange.
> Favor de responder en los foros públicos asi todos se benefician.
> (Address scrambled with ROT-13)



Re: VFP OLE Object story. by Kervin

Kervin
Thu Jul 01 09:25:09 CDT 2004

The story is I have web application which will access by more than 10 social
services center,
so I want to deploy the print receipt process to client side, I have success
to use a vbscript to
launch a "Access.application" object, then pass the parameter to the Access,
and let the Access get the data
by XML, finally, print the receipt by Access report writer directly.

I want to do the same thing with VFP8.

Kervin




Re: VFP OLE Object by Zeke

Zeke
Fri Jul 02 02:54:31 CDT 2004

When you register an EXE as a COM server you need to use a different syntax.
Instead of running regsvr32 you run your server exe with the switch
/regserver. To unregister use /unregserver. The following is copied from the
help system:

Registering an Automation Server
Your Automation servers are available to other applications once the servers
have been added to the Windows Registry. When you build an Automation
server, it's automatically registered on the build machine. You can also
register your servers on other machines.

When you use the Visual FoxPro Setup to create setup disks, the setup
program registers your servers on your customers' machines. You can also
manually register servers.

To register an .exe component

a.. Run the .exe file with the /regserver switch.
For example, to register Myserver.exe, run the following command:

myserver /regserverTo remove an .exe component registry entry

a.. Run the .exe file with the /unregserver switch.
For example, to unregister Myserver.exe, run the following command:

myserver /unregserverTo register a .dll component

a.. Run REGSVR32 with the name of the server.
For example, to register Myserver.dll run the following command:

REGSVR32 myserver.dllTo remove a .dll component registry entry

a.. Run REGSVR32 with the name of the server and the /u switch.
For example, to register Myserver.dll run the following command:

REGSVR32 /u myserver.dllNote The registry contains the full path name to
the file, so if you move the file, you'll need to register it again.


"Kervin Lo" <kwlo@siksikyuen.org.hk> wrote in message
news:%23gtC352XEHA.2500@TK2MSFTNGP09.phx.gbl...
> Hi, all
>
> I have tried like that
>
> DEFINE CLASS cPerson AS Custom OLEPUBLIC
> test=SPACE(10)
> PROCEDURE Init
> this.test="start"
> ENDPROC
>
> FUNCTION FullName
> RETURN this.test
> ENDPROC
>
> ENDDEFINE
>
> Then Compile to comdata.dll, and try the follow code, but it prompt
> "COMDATA.CPERSON" not found,
>
> a=CREATEOBJECT("comdata.cPerson")
> ? a.test
> ? a.FullName()
> a.release
>
> I tried to Compile the DLL name same as the project name, it can
> createobject successful, but it cannot find the "a.test".
> I don't know why, I am using VFP8
>
> BTW, I compiled to a exe, but it is not allow to regsvr32, it prompt not
> entry point.
>
> Thanks
> Kervin
>
>
> "Alex Feldstein" <nyrks@Kzicf.bet>
> ???????:utm7e0ppiftavr0kuhugi6u5e2n5kmb6nt@4ax.com...
> > On Thu, 1 Jul 2004 16:09:34 +0800, "Kervin Lo"
> > <kwlo@siksikyuen.org.hk> wrote:
> >
> > >Do anyone have a sample for write a OLE Object?
> > >I need to create a object call by VBSCRIPT to display a report in
client
> > >side.
> >
> >
> > Kervin
> >
> > It all depends on what you generically call an "ole object".
> >
> > If you mean an ActiveX control. No. VFP cannot create ActiveX
> > controls. Can read them, can subclass and modify them but cannot
> > create them.
> >
> > If what you mean is a COM object, then it is fairly easy using the
> > OLEPUBLIC modifier.
> >
> > See examples in the Fox Wiki:
> > http://fox.wikis.com/wc.dll?Wiki~COMComponentExample
> >
> > Your message is not very clar on what you need to do. Do you mean you
> > plan to use VBS in an ASP page to display a Fox report (FRX)?
> >
> > You cannot display an FRX outside of VFP as the non-VFP client does
> > not understand the format. What is normally done in those cases is
> > onverting it to another format. The most common is by printing it to a
> > PDF writer and exporting it (or sending it through HTTP to a browser)
> > as PDF.
> >
> > HTH
> >
> >
> >
> >
> > Alex Feldstein
> > ________________________________
> > Microsoft Visual FoxPro MVP
> > Please respond in the public groups so that everybody
> > can benefit from the exchange.
> > Favor de responder en los foros públicos asi todos se benefician.
> > (Address scrambled with ROT-13)
>
>



Re: VFP OLE Object by Kervin

Kervin
Fri Jul 02 08:46:47 CDT 2004

Hello, I tried as follow, but fail,

DEFINE CLASS cPerson AS Custom OLEPUBLIC

test=SPACE(10)
PROCEDURE Init
this.test="start"
ENDPROC

FUNCTION FullName
RETURN this.test
ENDFUNC

ENDDEFINE

*** Make a EXE vfpserver.exe and register by /regserver.

I make a file to create object.

a=CREATEOBJECT("vfpserver.cPerson")
yy =a.test
xx=a.FullName()
a.release

the error prompt that,
a.test cannot found.
a.fullname() prompt syntax error.

What is the wrong I did, please advise.

Thanks
Kervin



Re: VFP OLE Object by Kervin

Kervin
Fri Jul 02 11:04:06 CDT 2004

I create all things with new project, I can do it finally,
just the COM Server cannot Preview the report, but it can print.
Thanks.




Re: VFP OLE Object by swdev2

swdev2
Mon Jul 05 16:59:47 CDT 2004

why not output it to an html file instead ?
then each time you call it the remote browser 'user' can see it IN their
browser, then print it FROM the browser.
regards / xie xie [Bill]
--
William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
email.
Mondo Cool TeleCom -> http://www.efgroup.net/efgcog.html
Mondo Cool WebHosting -> http://www.efgroup.net/efglunar.html
Mondo Cool Satellites -> http://www.efgroup.net/sat
VFP Webhosting? You BET! -> http://efgroup.net/vfpwebhosting
mySql / VFP / MS-SQL

"Kervin Lo" <kwlo@siksikyuen.org.hk> wrote in message
news:ete8E5EYEHA.716@TK2MSFTNGP11.phx.gbl...
> I create all things with new project, I can do it finally,
> just the COM Server cannot Preview the report, but it can print.
> Thanks.
>
>
>



Re: VFP OLE Object by kervin

kervin
Tue Jul 06 22:27:00 CDT 2004

Because I need print on a preprinted form, which is special paper size using
on dot matrix printer with a tracker.

it require precise positioning, precise form feed and Chinese printing, so I
need a report writer to handle it and it must be an one click operation.

I chose VFP because it can embedded report write into exe, and it was not
required install any
shared libraries in system32.

KL

"swdev2" <wsanders.bob@bob.efgroup.com> ¦b¶l¥ó
news:%23WfnZMuYEHA.712@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
> why not output it to an html file instead ?
> then each time you call it the remote browser 'user' can see it IN their
> browser, then print it FROM the browser.
> regards / xie xie [Bill]
> --
> William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
> email.
> Mondo Cool TeleCom -> http://www.efgroup.net/efgcog.html
> Mondo Cool WebHosting -> http://www.efgroup.net/efglunar.html
> Mondo Cool Satellites -> http://www.efgroup.net/sat
> VFP Webhosting? You BET! -> http://efgroup.net/vfpwebhosting
> mySql / VFP / MS-SQL
>
> "Kervin Lo" <kwlo@siksikyuen.org.hk> wrote in message
> news:ete8E5EYEHA.716@TK2MSFTNGP11.phx.gbl...
> > I create all things with new project, I can do it finally,
> > just the COM Server cannot Preview the report, but it can print.
> > Thanks.
> >
> >
> >
>
>