[Win32utils-devel] win32-shortcut problems

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Tue Sep 21 09:32:42 EDT 2004

Hi Dan,

> Hi all,
> I've started porting the Win32::Shortcut Perl module over to Ruby.  I've
> done some initial work and committed it to CVS (look under win32utils - I
> goofed and made a toplevel dir as well - it's empty).
> Anyway, everything compiles fine, but when I do "s = Shortcut.new" I get a
> weird error:
> test.rb:11:in `initialize': undefined method `new' for false:FalseClass
> (NoMethodError)
> The initialize method is copied from the _Instance(...) part of the
> Shortcut.xs file.
> Any ideas as to what's wrong?
You have missed two things.

1) call CoInitialize before call CoCreateInstance like this:
   hres = CoInitialize(NULL);
     hres = CoCreateInstance(
       (void **) &ptr->ilink

2) define error class cShortcutError after rb_define_class_under like this:
   cShortcutError = rb_define_class_under(mWin32,"ShortcutError",rb_eStandardError);


Park Heesob

More information about the win32utils-devel mailing list