48件ヒット
[1-48件を表示]
(0.024秒)
種類
- インスタンスメソッド (36)
- 特異メソッド (12)
ライブラリ
- win32ole (48)
キーワード
- handler= (12)
-
on
_ event (12) -
on
_ event _ with _ outargs (12)
検索結果
先頭4件
-
WIN32OLE
_ EVENT # handler=(obj) -> () (37.0) -
イベント処理を実行するオブジェクトを登録します。
...def initialize
@completed = false
end
attr_reader :completed
def onDocumentComplete(disp, uri)
disp.document.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}"
end
@completed = true
end
def method_missing(id, *args)
pu......t}"
end
end
ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
event.handler = IeHandler.new
ie.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if event.handler.completed
WIN32OLE_EVENT.message_loop
end
ie.Quit... -
WIN32OLE
_ EVENT # on _ event(event = nil) {|*args| . . . } -> () (19.0) -
イベント通知を受けるブロックを登録します。
...、
WIN32OLE_EVENT#on_event_with_outargsを利用してください。
@raise WIN32OLERuntimeError WIN32OLE_EVENT#unadviseによってイベン
トソースと切断済みです。
ie = WIN32OLE.new('InternetExplorer.Application')
ev = WIN32OLE_EVENT.new......(ie, 'DWebBrowserEvents2')
ev.on_event("NavigateComplete2") do |browser, url|
puts url
end
同じオブジェクトに対してeventパラメータを指定したブロックと指定しないブ
ロックが混在している場合、通知されたイベントに対応するブロック......InternetExplorer.Application')
ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
ev.on_event("NavigateComplete2") do |browser, url|
puts url
end
ev.on_event do |*args| # <- NavigateComplete2イベント時は実行されない
puts args[0]
end
...
当メソッドはイベン... -
WIN32OLE
_ EVENT . message _ loop -> () (19.0) -
Windowsのメッセージポンプを実行します。
...event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
b = false
event.on_event('DocumentComplete') do |disp, uri|
disp.document.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}" #=> ダウンロード=http://www.ruby-lang.org/ja/downloads/ など
end
disp.......quit
b = true
end
ie.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if b
WIN32OLE_EVENT.message_loop
end
なお、メソッド名はloopですが、呼び出し時および既にキューイングされたメッ
セージの処理中にキューされたメッセージ... -
WIN32OLE
_ EVENT # on _ event _ with _ outargs(event = nil) {|*args| . . . } -> () (7.0) -
イベント通知を受けて結果を呼び出し元へ返すブロックを登録します。
...ド名を指定します。引数を省略した場合は、すべて
のイベントを対象とするブロックの登録となります。
WIN32OLE_EVENT#on_eventと異なり、イベントのブロック変数に戻り値を
設定できます。
@param event イベント名を文字列かシ......で受けてください。
@raise WIN32OLERuntimeError WIN32OLE_EVENT#unadviseによってイベン
トソースと切断済みです。
ie = WIN32OLE.new('InternetExplorer.Application')
ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
ev.on_event('BeforeNavigat......e2') do |*args|
args[6] = true unless args[4] # Cancel = true unless PostData
end
当メソッドはイベント名の大文字小文字を区別するほか、イベント名の存在確
認を行いません。このため、誤ったイベント名を記述してもエラーとはなら...