[IronPython] PreferComDispatch - Odd Behaviour

Shri Borde Shri.Borde at microsoft.com
Mon Apr 14 21:28:59 CEST 2008


We infer that the object implements IWshShell3 which declared the CurrentDirectory property. From the TLB info, we know about CurrentDirectory right away. However, SpecialFolders is declared on the base interface IWhsShell. Looks like we just need to walk up the class hierarchy. We currently don't do this. I have opened http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16107 to track this.

SpecialFolders does appear when you use it because we use IDispatch.GetIDsOfNames on it, and it is there ofcourse.

Thanks,
Shri
Want to work on IronPython, IronRuby, F#<http://blogs.msdn.com/ironpython/archive/2008/02/25/ironpython-ironruby-and-f-openings-in-dev-test-and-pm.aspx>? Visit http://blogs.msdn.com/ironpython/

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell
Sent: Saturday, April 12, 2008 11:53 PM
To: Discussion of IronPython
Subject: [IronPython] PreferComDispatch - Odd Behaviour

IP2.0.0.1000
from System import Type, Activator
wb = Activator.CreateInstance(Type.GetTypeFromProgID("WScript.Shell"))
print dir(wb)
print wb.CurrentDirectory()
print wb.SpecialFolders("Desktop")
print dir(wb)

The first dir of wb is missing a method which appears as soon as a call is made to it.
Interestingly CurrentDirectory is listed in the first dir without being called.

['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames
', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize
LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__',
 '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__'
, '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__']
c:\code\comtry
c:\users\daftspaniel\desktop
['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames
', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize
LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'SpecialFolders', 'ToStr
ing', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__
init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '_
_str__']

Thanks,
Davy Mitchell

--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080414/57da93ed/attachment-0001.html>


More information about the Ironpython-users mailing list