「rubyの入門」rubyでwin apiを利用してウィドウを表示するサンプル

rubyコード:
@window_proc = API::Callback.new('LLLL’,’I’)do |hwnd, msg,wparam,lparam|
ret = 0
case msg
when WM_PAINT
ps = PAINTSTRUCT.new
hdc = BeginPaint(hwnd, ps.data)
mem_dc = CreateCompatibleDC(0)
SelectObject(mem_dc,@bk_bmp_handle)
BitBlt(hdc,20,20,299,299,mem_dc,0,0,SRCCOPY)
EndPaint(hwnd, ps.data)
DeleteDC(mem_dc)
when WM_DESTROY
PostQuitMessage 0
else
ret = DefWindowProc(hwnd,msg,wparam,lparam);
end
ret
end

Ruby

Posted by arkgame