●WIN32API使い方
ruby-1.4.5/ext/Win32API/Win32API.c を元に解説する。
getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
のようにして使う。
引数は、
Win32API.new(dllname, proc, import, export)
dllname 読みこみたいdllのファイル名から.dllをとったもの。
proc そのdllの中の実行したいプロセスの名前
import Rubyからdllにわたす引数の形式を文字列で指定。(大文字小文字の違いは無視)
N, n, L, l 数値
P, p ポインター
I, i 整数
export dllからRubyに渡す値。つまり帰り値の形式を文字列で指定。(大文字小文字の違いは無視)
V, v void。つまり返り値無し
N, n, L, l 数値
P, p ポインター
I, i 整数
このようにしてnewしてできたオブジェクトにcall methodをよんでやる。
getCursotPos.call(lpPoint)
というように。
●cursor.rb
require 'Win32API'
def get_cursor_pos
lpPoint = " " * 8 # store two LONGs
Win32API.new("user32", "GetCursorPos", ['P'], 'V').Call(lpPoint)
p lpPoint.unpack("LL")
end
get_cursor_pos
def set_cursor_pos(x, y)
Win32API.new("user32", "SetCursorPos", ['i', 'i'], 'V').Call(x, y)
end
set_cursor_pos(100, 100)
●Win32API at Ruby
ソース http://cvs.netlab.co.jp/cgi-bin/cvsweb/ruby/ext/Win32API/Win32API.c
http://www.microsoft.com/japan/developer/winds/sdk/sdk.htm
http://cvs.netlab.co.jp/doc/ruby/examples/Win32API/point.rb
http://cvs.netlab.co.jp/doc/ruby/examples/Win32API/getch.rb
ftp://ftp.netlab.co.jp/pub/lang/ruby/pc/rbcw143-Win32API.zip
きちんとした説明ページはどこにあるのだろう?
●ActiveScriptRuby http://www.geocities.co.jp/SiliconValley-PaloAlto/9251/ruby/
JScript, VBScriptと同じようにRubyScriptが使える。
MIDAS Digital Audio System http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/midas.html
●VisualRuby http://www.threeweb.ad.jp/~nyasu/vruby/
Ruby on Windows link http://www.threeweb.ad.jp/~nyasu/software/rubyonwin.html
mciplay.rb http://www.threeweb.ad.jp/~nyasu/software/ruby.html#mciplay
CyclicAgent http://www.threeweb.ad.jp/~nyasu/software/ruby.html#cyclicagent
MS AgentをRubyから駆動
●WIN32OLE at Ruby
WIN32OLE http://homepage1.nifty.com/markey/ruby/win32ole/index.html
mkcom http://homepage1.nifty.com/markey/ruby/script/mkcom.html
Ruby/GTK http://homepage1.nifty.com/markey/ruby/gtk-win/index.html
Access97 meets Ruby http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/access.html
DAO+Ruby http://www.geocities.co.jp/SiliconValley-SanJose/9297/html/ruby.html
http://ruby-lang.jaist.ac.jp:8000/jp/workshop/ws2.txt
●Ruby for WIN32
Ruby Win32 http://homepage1.nifty.com/arima/ruby/index.htm
guion http://member.nifty.ne.jp/guion/SOFT/INDEX.HTM
MIDI to score, RubiMidi
WINGKR http://members.xoom.com/badooley/wingkr/
Win32 Gui Kit for Ruby by Bryce Dooley. But it stopped at 10/9/99.
●非矩形ウィンドウ at WIN32
http://www.bekkoame.ne.jp/~yoshidam/
http://www.bekkoame.ne.jp/~yoshidam/rubychan0_5.zip
VisualuRuby中のswin.dllが必要
http://www.threeweb.ad.jp/~nyasu/software/vrproject.html
http://www.threeweb.ad.jp/~nyasu/vruby/core.html
http://www.threeweb.ad.jp/~nyasu/vruby/vruby_exe.lzh
『CYGWIN版ruby-1.4.4でのswin.dllの実行形式』をダウンロードし解凍すると、swin.dllがはいっている。
reference http://www.threeweb.ad.jp/~nyasu/vruby/referer/index.html
●その他
http://www.isc.meiji.ac.jp/~ee77038/ruby/about/sample.html
sampleのie.rbが、インターネットエクスプローラ制御デモだ。使用ライブラリ win32ole
topics http://ruby.freak.ne.jp/ml/topics.html
ruby api http://www.ueda.info.waseda.ac.jp/~igarashi/ruby/xml.html#rubyapi2
png http://www.isc.meiji.ac.jp/~ee77038/
http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/ruby_link.html
Ruby link
http://www1.mirai.ne.jp/~gyo/xyzzy.html#ruby-mode
ruby-mode.el