Thierry
Thu Mar 04 04:52:46 CST 2004
> One must admit activeX are more comfortable on forms...
Documentation is not clear whether a form is required or not (see below =
)
--=20
Th N
Abaque
Accessing ActiveX Controls and Objects
You can use any ActiveX control that is available on your computer. To =
use an ActiveX control, you add it to a form, then set its properties, =
write handlers for its events, or call its methods. You can add an =
ActiveX control to a form using the Form Controls toolbar or the OLE =
Container control, or by using code. For details about adding an ActiveX =
control in the Form Designer, see Adding OLE.
You can create an ActiveX control in code in much the same way you would =
create any Visual FoxPro control. However, before creating the control =
you must determine the name of the control's class library, which is =
stored in the Windows registry. If you have no other way to determine =
the class library name, use the Form Designer to create the control (as =
described in the previous section), and then get the control's OLEClass =
property.
-------------------------------------------------------------------------=
-------
ActiveX objects can be created directly with CREATEOBJECT( ), and don't =
require an instance of a form.
To create an ActiveX control in code=20
1.. Call CREATEOBJECT( ) to create a form.=20
2.. Call the new form's AddObject method to add the control, =
specifying olecontrol as the class. You must pass the control's class =
library name as the third parameter of the AddObject method.=20
For example, the following program creates a new form and adds an =
outline control to it:
oMyForm =3D CREATEOBJECT("form")
oMyForm.AddObject("oleOutline","olecontrol", "MSOutl.Outline")
-------------------------------------------------------------------------=
-------
After you've created the form and control, you can display the form by =
calling its Show method, and display the control by setting its Visible =
property to true:
oMyForm.oleOutline.Visible =3D .T.
oMyForm.ShowSome ActiveX controls aren't designed primarily to be used =
interactively by a user. For example, a timer control doesn't support =
methods for user interaction. Even then, you can still create the =
control on a form because the control will usually make available a =
default visible component, such as an icon. Frequently you will not be =
able to change or resize the icon.
If you don't want your application to display the icon for =
non-interactive controls, you can hide the control by setting the =
Visible property of its OLE container control to false, or set its Left =
property to a negative value (such as -100) that moves it off the =
visible portion of the screen. Alternatively, you can place the control =
on a form that's never made visible (that is, for which the Show method =
is never called). In all cases, you can still call the control's methods =
as if the control were visible.
"Thierry Nivelet" <info_nospam@abaqueinside.com> a =E9crit dans le =
message de news:e7d4iPdAEHA.4080@TK2MSFTNGP09.phx.gbl...
> Didn't work neither
Which message did you get ?
One must admit activeX are more comfortable on forms...
I already had the same experience.
I don't know why and don't like it.
You may take a look at some commands like
SYS(2333) - ActiveX Dual Interface Support
--=20
Th N
Abaque
"toylet" <toylet_at_mail.hongkong.com> a =E9crit dans le message de =
news:uahWqKdAEHA.1964@TK2MSFTNGP11.phx.gbl...
> Didn't work neither. I could do that with form designer, but just=20
> curious on how to subclass an activeX control by codes.
>=20
> > owinsock=3Dcreateobject("mywinsock", "MSWinsock.Winsock.1")
> > define class mywinsock as olecontrol
> > procedure DataReceived
> > <code>
> > enddefine
> > It seems that olecontrol class expects OLE class ID as first =
parameter of its init() event method
>=20
>=20
> --=20
> .~. Might, Courage, Vision. In Linux We Trust.
> / v \
http://www.linux-sxs.org
> /( _ )\ Linux 2.4.22-xfs
> ^ ^ 6:22pm up 3 days 8:49 load average: 1.00 1.00 1.00