ipconfig /all を GUIで確認
なんか「Tunnel adapter ローカル エリア接続」とかがいっぱい出すぎでスクロールしちゃうので、アウトラインエディタぽい(言い過ぎ)。
require 'vr/vrcomctl' require 'vr/vrlayout' $confs = [] IO.popen("ipconfig /all","r"){|f| conf=nil f.each_line{|n| n=n.rstrip if n =~ /^ / $confs.last << n elsif n.size > 0 $confs << [n] end } $confs << conf if conf } class WIPConfForm <VRForm include VRResizeable def construct self.caption = "IP config" addControl VRListbox,"tab","" addControl VRText, "msg", "",0,0,0,0,WStyle::WS_VSCROLL @tab.setListStrings $confs.map{|f| f.first } @tab.select( 0 ) @k1=VRVertTwoPaneFrame.new(@tab,@msg).setup(self) tab_selchanged @tab.focus end def tab_selchanged @msg.text = $confs[@tab.selectedIndex].join("\r\n") end def self_resize(w,h) @k1.move 0,0,w,h end end VRLocalScreen.start WIPConfForm
はじめはRuby/tk を使おうと思ったらActiveRubyにはそっちは入って無くてVisualRubyが入ってると言うことだったのでそっちを使った。
VRVertTwoPaneFrame で、分割の初期サイズの指定の仕方が分からないので誰か教えてください(本当はリストのウィンドウのサイズが、もっと小さい方がいい)。