From: Masaki Suketa Date: 2005-08-06T17:27:11+09:00 Subject: Re: Question about WIN32OLE_EVENT. In message "Question about WIN32OLE_EVENT." on 05/08/05, "Michael Kelly" writes: > So, I'm clear on how to attach to events: > > @ie = WIN32OLE.new( 'InternetExplorer.Application' ) > browserEvents = WIN32OLE_EVENT.new( @ie, 'DWebBrowserEvents2' ) > browserEvents.on_event { |*args| eventHandler( *args ) } > > But how does one detach from events? Unfortunately, there is no way to detach from events. So, use global flag variable instead. $attached = true def eventHandler(*args) if ($attached) .... end end # attach event handler browserEvents.on_event{|*args| eventHandler(*args)} ... # dettach event handler $attached = false In future release, Win32OLE provides the method to detach event. Regards, Masaki Suketa