Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ActiveX Objects
Message
From
28/01/2008 14:57:16
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01286285
Message ID:
01286290
Views:
49
>>Hello,
>>
>>I am not sure how to instantiate objects from ActiveX.
>>
>>I am using an ActiveX control, and according to the documentation this control has several member objects.
>>
>>Instantiating the ActiveX control itself works fine by just dropping the ole control on a form.
>>
>>In VB, accessing the member objects is done like this:
>>
>>Object = "{27036179-0999-461D-B06E-B1E86B21B6E7}#1.0#0"
>>Public OMRProcessor As OMRProcessor
>>
>>But I don't know how to translate that into VFP.
>>
>>Any idea?
>
>Just guessing you may want to look at createobject and createobjectx functions.

I think createobject works only with VFP and automation enabled applications.
According to VFP help, I have to create a OLEOBJECT container class:
PUBLIC frmOLETest
frmOLETest = CREATEOBJECT('Form')
frmOLETest.Visible = .T.

frmOLETest.AddObject('OCXTest', 'BlueOLEControl', 'MSComctlLib.ListViewCtrl')
frmOLETest.OCXTest.View = 2
frmOLETest.OCXTest.ListItems.Add(1,'one','Item One')
frmOLETest.OCXTest.ListItems.Add(2,'two','Item Two')

DEFINE CLASS BlueOLEControl AS OLEControl
   * Set property for Outline ActiveX control.
   .Object.Backcolor = 16776960
   
   * Set properties for the OLE Container control.
   Visible = .T.
   Height = 100
   Width = 200
ENDDEFINE
But that would work only with the ActiveX control itself, not with its member objects.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform