zxem
12/19/2007 7:01:00 PM
On Dec 19, 3:37 pm, zxem <david.z...@gmail.com> wrote:
> I am trying to create a ruby class base on a Win32 COM typelib info.
> The class I tried to create is as followed.
>
> COM Type info: (There is no registry entry for this class)
>
> [
> uuid(0058FFFF-5B03-11D3-A520-00805F9BE596),
> helpstring("Static members of FOHoard"),
> helpcontext(0x00580000),
> hidden
> ]
> dispinterface FOHoardHelper {
> properties:
> methods:
> [id(00000000), propget, hidden, helpstring("The type name
> of this object instance (Default)")]
> BSTR Item();
> [id(0x00007ffd), hidden, helpstring("Returns a reference
> to this helper instance"), helpcontext(0x00007ffd)]
> FOHoardHelper* Me();
> [id(0x00580002), helpstring("Create a new empty hoard
> (collection)"), helpcontext(0x00580002)]
> FOHoard* createEmpty();
> };
>
> Ruby class:
>
> class FOHoardHelper
> include WIN32OLE::VARIANT
> attr_reader :lastargs
> attr_reader :dispatch
> attr_reader :clsid
> attr_reader :progid
>
> def initialize(obj = nil)
> @clsid = "{0058FFFF-5B03-11D3-A520-00805F9BE596}"
> if obj.nil?
> @dispatch = WIN32OLE.new @clsid
> else
> @dispatch = obj
> end
> end
>
> def createEmpty()
> ret = @dispatch._invoke(5767170, [], [])
> @lastargs = WIN32OLE::ARGV
> ret
> end
>
> end
>
> My test code:
> f = FOHoardHelper.new;
> hlist = f.createEmpty;
>
> I got this error message:
> F:/NetBeansProjects/TAVolTest/lib/CalendarUtils.rb:45:in `initialize':
> failed to create WIN32OLE object from `{0058FFFF-5B03-11D3-
> A520-00805F9BE596}' (WIN32OLERuntimeError)
>
> HRESULT error code:0x80040154
>
> Could you give me some help?
Please ignore my question