By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

How to add a method member to a class or object in run-time?

P: n/a
In run-time,is there any approach to add or revise the
members,such as method or attribute ,of a class or object?
As for the object of class soapclient30 in MS soap
toolkit, after it executes the mssoapinit method,it will
have some additional methods which have been described in
WSDL file. For an example,if a Web service provides
an "divide" method,the WSDL filename is mycalculator.wsdl:

set soapclient = CreateObject("MSSOAP.SoapClient30")
soapclient.mssoapinit "mycalculator.wsdl", "", "", ""
soapclient.divide 10,5

that is,the soapclient object has the divide method.
how to add the "divide" method for SoapClient30 class
internally?
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Peter,

"peter" <an*******@discussions.microsoft.com> wrote
set soapclient = CreateObject("MSSOAP.SoapClient30")
soapclient.mssoapinit "mycalculator.wsdl", "", "", ""
soapclient.divide 10,5

that is,the soapclient object has the divide method.
how to add the "divide" method for SoapClient30 class
internally?

You simply need to implement IDispatch yourself (don't
mark your interface as nonextensible). Shouldn't be too
hard with help of the Automation helpers.

Eventually, you can also create type information on the
fly and use the CreateStdDispatch, CreateDispTypeInfo,
DispInvoke to implement your interface. That way you
could build your dynamic object with ATLs IDispatchImpl.

-hg
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.