
Howto design plugin control(s) and query system for them
I would like to design an app that queries the system for all controls that
implement a particular interface, as well as design some of the controls that
implement these interfaces. Then in the future, I can just design new controls
with the same interface, without having to change the main app.
I thought I could use the Implements keyword in the control for an interface I
design in a separate class module, but when I try to use such a control, (1) I
can't see or use the interface methods/properties of the control's variable, and
(2) I can't Set another variable (with type equal to the base interface type)
equal to the control variable.
For example, let's say I have a VB activeX control project. In that project, I
have a class module (call it ITest), with one method:
Public Sub TestMethod()
End Sub
And also in the project, I have a User Control (call it TestControl).
In the TestControl code, I put:
Implements ITest
Private Sub ITest_TestMethod()
Beep
End Sub
This control compiles just fine.
Then I create a standard exe, where I put a TestControl (call it TestControl1)
on the main form.
Then if I do:
Private objTest as ITest
and in the form's load function:
Set objTest = TestControl1
(This fails.)
TestControl1.TestMethod
(This also fails -- TestMethod doesn't even show up in the drop-down list of
TestControl1's member functions.)
If anyone could give me some insight as to what I might be doing wrong, I would
greatly appreciate it. I also would like to hear ideas on how to determine
which controls support a specific interface (if this is even possible -- I would
think it should be).
*************************************************
Patrick Noffke
QTI
Sussex, WI
*************************************************