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