From: James French Date: 2010-11-08T21:29:55+09:00 Subject: Re: win32ole enum -----Original Message----- From: James French [mailto:James.French@naturalmotion.com] Sent: 08 November 2010 11:36 To: ruby-talk ML Subject: win32ole enum Hi Rubyists, If someone could help me with this I'd be very grateful... I'm trying to use WIN32OLE to call a method that takes an enum called EUserDefinedTree. I want to set it to kAbsoluteFilePath. I have a handle to the method and ole_type_detail reports the param as type USERDEFINED. Trouble is I have no idea how to pass in kAbsoluteFilePath as the value. Can anyone point me in the right direction? I've already had a good google but nothing turned up. Cheers, James Bit of progress: module CW_CONST end #------------------------------------------------------------------------------------------ def initCodeWarrior cwApp = WIN32OLE.new('CodeWarrior.CodeWarriorApp') WIN32OLE.const_load(cwApp, CW_CONST) puts CW_CONST::KAbsoluteFilePath # => 0 puts CW_CONST::KEnvironment # => 1 puts CW_CONST::KRegistry # => 2 cwApp.CreateUserTree("displayname", "value", CW_CONST::KAbsoluteFilePath, "keyname") end I can now *access* the enum values I want, but I can't pass one as the third param to CreateUserTree - the method is failing with an uninformative message at any rate. Do I need to convert it into some kind of object?