require 'Win32API' class Win32AqiCall WM_COMMAND = 0x0111 CHART_CMD_UPDATE_DATA = 33324 MB_OK = 0 def initialize @message_box = Win32API.new('user32', 'MessageBoxA', %w(p p p i), 'i') @register_window_message = Win32API.new('user32', 'RegisterWindowMessageA', %w(p), 'i') @find_window = Win32API.new('user32', 'FindWindowA', %w(p p), 'l') @find_window_ex = Win32API.new('user32', 'FindWindowExA', %w(i i p p), 'l') @post_message = Win32API.new('user32', 'PostMessageA', %w(l l l l), 'l') end def MessageBox(wnd, text, caption, type = MB_OK) @message_box.call(wnd, text, caption, type) end def RegisterWindowMessage(txt) @register_window_message.call(txt) end def FindWindow(class_name, window_name) @find_window.call(class_name, window_name) end def FindWindowEx(parent, child, class_name, window_name) @find_window_ex.call(parent, child, class_name, window_name) end def PostMessage(hwnd, msg, wparam, lparam) @post_message.call(hwnd, msg, wparam, lparam) end end
コメント