Win32ole used to work in 1.8, fails in 1.9 - help

here is my code that fails in 1.9....it used to show a popup under
windows

require 'win32ole'

class Testnet
def self.popup(msg)
   wsh = WIN32OLE.new('WScript.Shell')
   wsh.popup(msg, 0, "TESTNET POPUP")
end
end

···

--
Posted via http://www.ruby-forum.com/.

I should add windows is windows XP, sp3

Joe

···

--
Posted via http://www.ruby-forum.com/.

Works for me.

I'm running 1.9.2p180 on Windows XP sp3.

···

--
Posted via http://www.ruby-forum.com/.

Worked when I changed:
def self.popup(msg)
To:
def popup(msg)

···

--
Posted via http://www.ruby-forum.com/.

Worked for me in the first way.

···

--
Posted via http://www.ruby-forum.com/.

perhaps the local var wsh is going out of scope when the method ends ??

perhaps:

# ----------------------------------
require 'win32ole'
class Testnet

  def initialize()
    @wsh = WIN32OLE.new('WScript.Shell')
  end

  def popup(msg)
    @wsh.popup(msg, 0, "TESTNET POPUP")
  end

end # class

tn = Testnet.new()
tn.popup("This is a test message.")
# ----------------------------------

Also, sometimes if the text message passed to Windows API UI functions,
does not resolve to a valid string, they can fail silently.
You could add some validation code to the popup() method, before calling
the WSH popup function.

?

···

--
Posted via http://www.ruby-forum.com/.