I created a DLL using VFP which has classes (controls declared OLEPublic)
that I want to be used in another VFP application. We just want to avoid
compiling the application everytime we need to add another control (which
could behave differently from the base classes). I can successfully create
the objects using the CREATEOBJECT() method but when I'm adding the objects
to the form (for example) using the ADDOBJECT method, VFP raises an OLE error
saying that the class is not registered.

Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
possible to add an object to a container with VFP DLLs class?

The following codes run but cannot be seen in a form (or maybe I just don't
know how to make it visible in a form):
ldDateObject = CreateObject('<myDLL.ClassName>')
ldDateObject.Caption = 'Date:'
ldDateObject.Value = Date()
ldDateObject.Visible = .t.

This should add my Ole class but generates an error saying the class is not
registered:
<myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')

If I can't make it really work and will have to use active Xs, is there any
site that offers tutorials on how to create active Xs? Thanks in advance. :)

Re: VFP DLL by Krister

Krister
Tue Jan 23 08:13:53 CST 2007

A VFP dll cannot display a GUI. In order to do that you should build an EXE
instead.
/Krister


"Norbert" <Norbert@discussions.microsoft.com> wrote in message
news:6C07BD8C-07E5-4136-8A39-878FEDCBDDB6@microsoft.com...
>I created a DLL using VFP which has classes (controls declared OLEPublic)
> that I want to be used in another VFP application. We just want to avoid
> compiling the application everytime we need to add another control (which
> could behave differently from the base classes). I can successfully
> create
> the objects using the CREATEOBJECT() method but when I'm adding the
> objects
> to the form (for example) using the ADDOBJECT method, VFP raises an OLE
> error
> saying that the class is not registered.
>
> Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
> possible to add an object to a container with VFP DLLs class?
>
> The following codes run but cannot be seen in a form (or maybe I just
> don't
> know how to make it visible in a form):
> ldDateObject = CreateObject('<myDLL.ClassName>')
> ldDateObject.Caption = 'Date:'
> ldDateObject.Value = Date()
> ldDateObject.Visible = .t.
>
> This should add my Ole class but generates an error saying the class is
> not
> registered:
> <myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')
>
> If I can't make it really work and will have to use active Xs, is there
> any
> site that offers tutorials on how to create active Xs? Thanks in advance.
> :)
>
>
>
>



Re: VFP DLL by Dan

Dan
Tue Jan 23 10:53:10 CST 2007

You can create classes in VFP and compile then into a seperate EXE file.
Then to access them from your main application, you can use a code like
this:
* where oParentobj is a container or form.

oParentObj.newobject(NewControl_Name,NewControl_Type,VCXFile,ExeFile)


Someone may have a better suggestion, but I would recommend against using
the OLEPublic on VFP controls that you plan on using in VFP. There is
overhead required anytime you use COM objects, as well as the need to
register them on your deployment machines. This method I mentioned above
would allow you to break your application into segments and access the
classes when you have been of them. You would only need to recompile these
other classes if you make a change to them, or any classes that they are
derived from.



Good luck,

Dan Tallent





"Krister" <nospam@myprovider.com> wrote in message
news:BKoth.30158$E02.12281@newsb.telia.net...

>A VFP dll cannot display a GUI. In order to do that you should build an EXE
>instead.
> /Krister
>
>
> "Norbert" <Norbert@discussions.microsoft.com> wrote in message
> news:6C07BD8C-07E5-4136-8A39-878FEDCBDDB6@microsoft.com...
>>I created a DLL using VFP which has classes (controls declared OLEPublic)
>> that I want to be used in another VFP application. We just want to avoid
>> compiling the application everytime we need to add another control (which
>> could behave differently from the base classes). I can successfully
>> create
>> the objects using the CREATEOBJECT() method but when I'm adding the
>> objects
>> to the form (for example) using the ADDOBJECT method, VFP raises an OLE
>> error
>> saying that the class is not registered.
>>
>> Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
>> possible to add an object to a container with VFP DLLs class?
>>
>> The following codes run but cannot be seen in a form (or maybe I just
>> don't
>> know how to make it visible in a form):
>> ldDateObject = CreateObject('<myDLL.ClassName>')
>> ldDateObject.Caption = 'Date:'
>> ldDateObject.Value = Date()
>> ldDateObject.Visible = .t.
>>
>> This should add my Ole class but generates an error saying the class is
>> not
>> registered:
>> <myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')
>>
>> If I can't make it really work and will have to use active Xs, is there
>> any
>> site that offers tutorials on how to create active Xs? Thanks in
>> advance. :)
>>
>>
>>
>>
>
>



Re: VFP DLL by Norbert

Norbert
Tue Jan 23 22:57:01 CST 2007

Your're an angel... :) Thanks...

"Krister" wrote:

> A VFP dll cannot display a GUI. In order to do that you should build an EXE
> instead.
> /Krister
>
>
> "Norbert" <Norbert@discussions.microsoft.com> wrote in message
> news:6C07BD8C-07E5-4136-8A39-878FEDCBDDB6@microsoft.com...
> >I created a DLL using VFP which has classes (controls declared OLEPublic)
> > that I want to be used in another VFP application. We just want to avoid
> > compiling the application everytime we need to add another control (which
> > could behave differently from the base classes). I can successfully
> > create
> > the objects using the CREATEOBJECT() method but when I'm adding the
> > objects
> > to the form (for example) using the ADDOBJECT method, VFP raises an OLE
> > error
> > saying that the class is not registered.
> >
> > Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
> > possible to add an object to a container with VFP DLLs class?
> >
> > The following codes run but cannot be seen in a form (or maybe I just
> > don't
> > know how to make it visible in a form):
> > ldDateObject = CreateObject('<myDLL.ClassName>')
> > ldDateObject.Caption = 'Date:'
> > ldDateObject.Value = Date()
> > ldDateObject.Visible = .t.
> >
> > This should add my Ole class but generates an error saying the class is
> > not
> > registered:
> > <myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')
> >
> > If I can't make it really work and will have to use active Xs, is there
> > any
> > site that offers tutorials on how to create active Xs? Thanks in advance.
> > :)
> >
> >
> >
> >
>
>
>

Re: VFP DLL by Norbert

Norbert
Tue Jan 23 22:59:01 CST 2007

Thanks you Dan. I just realized how closed I was from solving my problem. I
actually tried already the sample code you gave but the difference was that I
used an Exe file instead of VCX file. Many thanks again... :)

"Dan Tallent" wrote:

> You can create classes in VFP and compile then into a seperate EXE file.
> Then to access them from your main application, you can use a code like
> this:
> * where oParentobj is a container or form.
>
> oParentObj.newobject(NewControl_Name,NewControl_Type,VCXFile,ExeFile)
>
>
> Someone may have a better suggestion, but I would recommend against using
> the OLEPublic on VFP controls that you plan on using in VFP. There is
> overhead required anytime you use COM objects, as well as the need to
> register them on your deployment machines. This method I mentioned above
> would allow you to break your application into segments and access the
> classes when you have been of them. You would only need to recompile these
> other classes if you make a change to them, or any classes that they are
> derived from.
>
>
>
> Good luck,
>
> Dan Tallent
>
>
>
>
>
> "Krister" <nospam@myprovider.com> wrote in message
> news:BKoth.30158$E02.12281@newsb.telia.net...
>
> >A VFP dll cannot display a GUI. In order to do that you should build an EXE
> >instead.
> > /Krister
> >
> >
> > "Norbert" <Norbert@discussions.microsoft.com> wrote in message
> > news:6C07BD8C-07E5-4136-8A39-878FEDCBDDB6@microsoft.com...
> >>I created a DLL using VFP which has classes (controls declared OLEPublic)
> >> that I want to be used in another VFP application. We just want to avoid
> >> compiling the application everytime we need to add another control (which
> >> could behave differently from the base classes). I can successfully
> >> create
> >> the objects using the CREATEOBJECT() method but when I'm adding the
> >> objects
> >> to the form (for example) using the ADDOBJECT method, VFP raises an OLE
> >> error
> >> saying that the class is not registered.
> >>
> >> Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
> >> possible to add an object to a container with VFP DLLs class?
> >>
> >> The following codes run but cannot be seen in a form (or maybe I just
> >> don't
> >> know how to make it visible in a form):
> >> ldDateObject = CreateObject('<myDLL.ClassName>')
> >> ldDateObject.Caption = 'Date:'
> >> ldDateObject.Value = Date()
> >> ldDateObject.Visible = .t.
> >>
> >> This should add my Ole class but generates an error saying the class is
> >> not
> >> registered:
> >> <myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')
> >>
> >> If I can't make it really work and will have to use active Xs, is there
> >> any
> >> site that offers tutorials on how to create active Xs? Thanks in
> >> advance. :)
> >>
> >>
> >>
> >>
> >
> >
>
>
>

Re: VFP DLL by Olaf

Olaf
Wed Jan 24 05:04:51 CST 2007

Hmm,

besides that solving your problem, the syntax of AddObject
regarding Ole classes should be:

form.Addobject("oData",,"Ole.Class")

So you'd leave out the second parameter, which is for
the standard VFP class, not for Ole.

Unlike Createobject() this is separated into two
parameters.

But you can really compile a VCX lib into an exe, then
SET CLASSLIB TO ....vcx IN some.exe
and then can simply use it as a native VFP calss
without having it olepublic.

Bye, Olaf.



Re: VFP DLL by Cy

Cy
Thu Jan 25 00:44:13 CST 2007

Norbert wrote:
> Thanks you Dan. I just realized how closed I was from solving my problem. I
> actually tried already the sample code you gave but the difference was that I
> used an Exe file instead of VCX file. Many thanks again... :)
>
> "Dan Tallent" wrote:
>
>> You can create classes in VFP and compile then into a seperate EXE file.
>> Then to access them from your main application, you can use a code like
>> this:
>> * where oParentobj is a container or form.
>>
>> oParentObj.newobject(NewControl_Name,NewControl_Type,VCXFile,ExeFile)
>>
>>
>> Someone may have a better suggestion, but I would recommend against using
>> the OLEPublic on VFP controls that you plan on using in VFP. There is
>> overhead required anytime you use COM objects, as well as the need to
>> register them on your deployment machines. This method I mentioned above
>> would allow you to break your application into segments and access the
>> classes when you have been of them. You would only need to recompile these
>> other classes if you make a change to them, or any classes that they are
>> derived from.
>>
>>
>>
>> Good luck,
>>
>> Dan Tallent
>>
>>
>>
>>
>>
>> "Krister" <nospam@myprovider.com> wrote in message
>> news:BKoth.30158$E02.12281@newsb.telia.net...
>>
>>> A VFP dll cannot display a GUI. In order to do that you should build an EXE
>>> instead.
>>> /Krister
>>>
>>>
>>> "Norbert" <Norbert@discussions.microsoft.com> wrote in message
>>> news:6C07BD8C-07E5-4136-8A39-878FEDCBDDB6@microsoft.com...
>>>> I created a DLL using VFP which has classes (controls declared OLEPublic)
>>>> that I want to be used in another VFP application. We just want to avoid
>>>> compiling the application everytime we need to add another control (which
>>>> could behave differently from the base classes). I can successfully
>>>> create
>>>> the objects using the CREATEOBJECT() method but when I'm adding the
>>>> objects
>>>> to the form (for example) using the ADDOBJECT method, VFP raises an OLE
>>>> error
>>>> saying that the class is not registered.
>>>>
>>>> Does ADDOBJECT supports classes created in the VFP DLL or it isn't really
>>>> possible to add an object to a container with VFP DLLs class?
>>>>
>>>> The following codes run but cannot be seen in a form (or maybe I just
>>>> don't
>>>> know how to make it visible in a form):
>>>> ldDateObject = CreateObject('<myDLL.ClassName>')
>>>> ldDateObject.Caption = 'Date:'
>>>> ldDateObject.Value = Date()
>>>> ldDateObject.Visible = .t.
>>>>
>>>> This should add my Ole class but generates an error saying the class is
>>>> not
>>>> registered:
>>>> <myForm>.AddObject('oDateObject', 'oleControl', '<myDLL.ClassName>')
>>>>
>>>> If I can't make it really work and will have to use active Xs, is there
>>>> any
>>>> site that offers tutorials on how to create active Xs? Thanks in
>>>> advance. :)
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
You could also use an APP file which would allow you to include several
VCX files in a single file.

--
Cy Welch
Senior Programmer
MetSYS Inc
http://www.metsysinc.com