Carpathia
asked on
ActiveX Forms
I am trying to develop an application which allows clients to develop their own ActiveX plugins which will appear in my app as form.
I have created an ActiveForm, which resides in test.ocx. In my client app I scan a directory at runtime, and register the test.ocx using LoadLibrary and GetProcAddress(RegisterDLL ).
However, Im having problems creating and displaying the form.
When I use CreateOLEObject and (loading the result into an OLEVariant), the function returns an IDispatch interface to my AX form object. This IDispatch has no methods which allow me to show the form.
So my question is, how do I get at my form, from this IDispatch ?
I want to be able to access the underlying form via properties or methods such as Top, Left and Show, ShowModal.
Sample source much appreciated, but a good explanation will earn the points.
Thanks !
I have created an ActiveForm, which resides in test.ocx. In my client app I scan a directory at runtime, and register the test.ocx using LoadLibrary and GetProcAddress(RegisterDLL
However, Im having problems creating and displaying the form.
When I use CreateOLEObject and (loading the result into an OLEVariant), the function returns an IDispatch interface to my AX form object. This IDispatch has no methods which allow me to show the form.
So my question is, how do I get at my form, from this IDispatch ?
I want to be able to access the underlying form via properties or methods such as Top, Left and Show, ShowModal.
Sample source much appreciated, but a good explanation will earn the points.
Thanks !
ASKER
Thanks eps. This solves the showing of the form, but still doesnt allow me access to top and left etc..
But Im really looking for a way to take my IDispatch from CreateOLEObject, and get access to the TActiveForm? or at least get hold of some other interface which defines top, left etc.
Thanks
But Im really looking for a way to take my IDispatch from CreateOLEObject, and get access to the TActiveForm? or at least get hold of some other interface which defines top, left etc.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks :)
I intiially thought your comment about the type library related just to components on the form, not the methods of the form itself.
I intiially thought your comment about the type library related just to components on the form, not the methods of the form itself.
Instead of
OleContainer1.DoVerb(ovSho w);
mybe you can better use
OleContainer1.Run;
Eps.
OleContainer1.DoVerb(ovSho
mybe you can better use
OleContainer1.Run;
Eps.
To load an ActiveX form into the container use this code:
OleContainer1.AutoActivate
OleContainer1.CreateObject
OleContainer1.DoVerb(ovSho
XXXXX is the name of the object.
If you want to access components on the ActiveX form you have to publish your own methods and properties in the Type Library editor.
Eps.