48件ヒット
[1-48件を表示]
(0.025秒)
別のキーワード
種類
- インスタンスメソッド (24)
- クラス (12)
- 特異メソッド (12)
ライブラリ
- win32ole (48)
クラス
-
WIN32OLE
_ EVENT (24) -
WIN32OLE
_ TYPE (12)
キーワード
-
WIN32OLE
_ EVENT (12) -
default
_ event _ sources (12) - handler= (12)
検索結果
先頭4件
-
WIN32OLE
_ EVENT . message _ loop -> () (18125.0) -
Windowsのメッセージポンプを実行します。
...Windowsのメッセージポンプを実行します。
message_loopメソッドは、Windowsメッセージがキューイングされている限りメッ
セージの読み出しとディスパッチを実行します。
COMのスレッド間/プロセス間通信はスレッド内で呼び出......てディスパッチすることで通知されます。
ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
b = false
event.on_event('DocumentComplete') do |disp, uri|
disp.document.getElementsByTagName('a').each do |e|
puts "......oads/ など
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 # handler=(obj) -> () (24.0) -
イベント処理を実行するオブジェクトを登録します。
...ジェクトをイベントハンドラとし
て登録します。
イベントハンドラはイベント名に「on」を前置します。もし、イベントに対応
するonメソッドが実装されていなければmethod_missingが呼ばれます。イベン
ト名は大文字小文字......解除するにはnilを指定します。
class IeHandler
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
@compl......ternetExplorer.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などの呼び... -
WIN32OLE
_ TYPE # default _ event _ sources -> [WIN32OLE _ TYPE] (24.0) -
型が持つソースインターフェイスを取得します。
..._EVENT.message_loopの呼び出しが必要な点に注意してください。
ここでは最終イベントのStatusTextChangeイベントのメッセージについては既
知としています。
# coding : cp932
require 'win32ole'
type = WIN32OLE_TYPE.new('Microsoft Internet Controls',......tialize
@completed = false
end
attr_reader :completed
end
source.ole_methods.each do |m|
WebEvent.module_eval do
define_method("on#{m.name}") do |*arg|
if arg[0] == "ページが表示されました"
@completed = true
end
puts "#{Time.now}: #{m.nam......NT.new(ctl)
evt.handler = WebEvent.new
ctl.navigate2 'http://www.ruby-lang.org/'
loop do
break if evt.handler.completed
WIN32OLE_EVENT.message_loop
end
ctl.Quit
このプログラムを実行するとWindows7のIE8環境では以下のような出力を得られ
ます。
2010-10-06 22... -
WIN32OLE
_ EVENT (12.0) -
OLEオートメーションサーバからのイベント通知を制御するクラスです。
...ーバへ登録できま
す。
=== サンプルコード
ie = WIN32OLE.new('InternetExplorer.Application.1')
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...