WIN32OLE - failed to create WIN32OLE

Discussion in 'Ruby' started by zxem, Dec 19, 2007.

  1. zxem

    zxem Guest

    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?
     
    zxem, Dec 19, 2007
    #1
    1. Advertising

  2. zxem

    zxem Guest

    On Dec 19, 3:37 pm, zxem <> 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
     
    zxem, Dec 19, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10
    Replies:
    6
    Views:
    957
    sck10
    Sep 1, 2006
  2. kiran
    Replies:
    5
    Views:
    3,553
  3. x1
    Replies:
    1
    Views:
    208
    Dave Burt
    Dec 7, 2005
  4. Masaki Suketa
    Replies:
    4
    Views:
    417
    Dave Burt
    Mar 27, 2006
  5. Chuck Remes
    Replies:
    1
    Views:
    108
    Chuck Remes
    Jan 5, 2010
Loading...

Share This Page