Board index » delphi » Dynamic Interfaces / Dynamic Classes

Dynamic Interfaces / Dynamic Classes

I'm not really sure if this isn't off-topic - if it is maybe someone
could just tell me where to post this:

I'm trying to set up a COM-Object with interfaces that I can change
during runtime.
If there is no possible way to do this I would like to change a class
during runtime.

The main point in doing so is the problem that the application that
uses the COM-Object should only be presented the procedures that suite
the situation. And in different situations some procedures/classes
should be supported and the user should have the possibility to query
if these classes/procedures are available at a special moment with the
"supports"-method.

Any idea?

Thanks in advance

Juergen

 

Re:Dynamic Interfaces / Dynamic Classes


Im Artikel <ab8f5bd6.0211191154.13016...@posting.google.com>,
juergenschlin...@gmx.de (Juergen Schlinker) schreibt:

Quote
>The main point in doing so is the problem that the application that
>uses the COM-Object should only be presented the procedures that suite
>the situation. And in different situations some procedures/classes
>should be supported and the user should have the possibility to query
>if these classes/procedures are available at a special moment with the
>"supports"-method.

A dynamic modification of an interface is useless, since the compiler must
create the code in advance, for the whole application, for all possible
methods. Consequently the interface must cover all methods, which ever may be
called.

You can provide a list of supported methods at any time, but it will be
cumbersome to evaluate the information in that list. Better let disabled
methods return error codes.

A better solution are multiple interfaces, and instead of providing a list of
supported methods, the object "manager" method can return the currently
applicable interface, as a reference or as a specific state id, from which the
application can determine the interface or the set of enabled methods.

DoDi

Re:Dynamic Interfaces / Dynamic Classes


"Juergen Schlinker" <juergenschlin...@gmx.de> skrev i melding
news:ab8f5bd6.0211191154.13016a8e@posting.google.com...

Quote
> I'm not really sure if this isn't off-topic - if it is maybe someone
> could just tell me where to post this:

> I'm trying to set up a COM-Object with interfaces that I can change
> during runtime.
> If there is no possible way to do this I would like to change a class
> during runtime.

> The main point in doing so is the problem that the application that
> uses the COM-Object should only be presented the procedures that suite
> the situation. And in different situations some procedures/classes
> should be supported and the user should have the possibility to query
> if these classes/procedures are available at a special moment with the
> "supports"-method.

It may be an idea to use "named procedures" (much like it works with dll's)
or messages. Create a standard routine that takes the command id or message
id as a parameter.

--
Bj?rge S?ther
bjorge@hahaha_itte.no

Re:Dynamic Interfaces / Dynamic Classes


Sounds like a nice solution to me.

Thanks for your quick help.

Jrgen

Quote
vb...@aol.com (VBDis) wrote in message <news:20021119185235.09814.00000505@mb-bk.aol.com>...
> Im Artikel <ab8f5bd6.0211191154.13016...@posting.google.com>,
> juergenschlin...@gmx.de (Juergen Schlinker) schreibt:

> >The main point in doing so is the problem that the application that
> >uses the COM-Object should only be presented the procedures that suite
> >the situation. And in different situations some procedures/classes
> >should be supported and the user should have the possibility to query
> >if these classes/procedures are available at a special moment with the
> >"supports"-method.

> A dynamic modification of an interface is useless, since the compiler must
> create the code in advance, for the whole application, for all possible
> methods. Consequently the interface must cover all methods, which ever may be
> called.

> You can provide a list of supported methods at any time, but it will be
> cumbersome to evaluate the information in that list. Better let disabled
> methods return error codes.

> A better solution are multiple interfaces, and instead of providing a list of
> supported methods, the object "manager" method can return the currently
> applicable interface, as a reference or as a specific state id, from which the
> application can determine the interface or the set of enabled methods.

> DoDi

Other Threads