Howto design plugin control(s) and query system for them 
Author Message
 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
*************************************************



Mon, 29 Sep 2003 06:47:26 GMT  
 Howto design plugin control(s) and query system for them
Quote:
> The reference is not your control itself. To get a reference to your control
> use the Object property:

>     Set objTest = TestControl1.Object
>     objTest.TestMethod

Thanks!  That solved one problem.

Quote:
> > 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).

> To determine the what controls supports your interface you can use the
> Component Category Manager.

Could you (or someone else) please give a brief description of how to do this in
VB?

If anyone is interested, I found a sample that does this in VC++.  Here is the
link:

http://msdn.microsoft.com/library/periodic/period97/snap797.htm

Pat



Tue, 30 Sep 2003 01:53:42 GMT  
 Howto design plugin control(s) and query system for them

Quote:
> Could you (or someone else) please give a brief description of how to do
this in
> VB?

There's a sample in my site.

--
Eduardo A. Morcillo
http://www.domaindlx.com/e_morcillo



Tue, 30 Sep 2003 02:45:24 GMT  
 Howto design plugin control(s) and query system for them
Thanks for the help thus far.  I've been able to do everything I wanted with
a combination of VB and ATL and the EnumControls example from your site.

I created a component category and modified the ATL code that registers the
control so that it also registers it as belonging to my category.  I did
this using the ICatRegister COM interface.

But it would be nice to be able to do this in VB somehow.  Is there someway
to customize the registration of an ActiveX control so that it registers it
as belonging to a custom Category (i.e. register it as implementing my
CATID)?  I want to be able to do this registration at install time.

Pat



Quote:
> > Could you (or someone else) please give a brief description of how to do
> this in
> > VB?

> There's a sample in my site.

> --
> Eduardo A. Morcillo
> http://www.domaindlx.com/e_morcillo



Sat, 04 Oct 2003 10:44:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Design plugin or component

2. DBCombo Control Crashes System at Design Time (Record Source Property)

3. Howto execute one query over multiple query results

4. Howto execute one query over multiple query results

5. Plugin system

6. Plugin system for an application

7. HOWTO: design access to db via custom objects

8. Label: howto put return in at design time

9. HOWTO: Tell Whether an App Runs in VB Design Environment

10. HowTo: Transparently access attached resources at design time

11. VBE in User Designed Control Design Mode

12. Howto hide system menu???

 

 
Powered by phpBB® Forum Software