Created
August 27, 2014 17:14
-
-
Save ha1t/afa86855afe719694a24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# | |
# @url http://www.ruby-lang.org/ja/man/html/Win32API.html | |
# @url http://delfusa.main.jp/delfusafloor/archive/www.nifty.ne.jp_forum_fdelphi/faq/00028.htm | |
# | |
require 'Win32API' | |
class Win32API | |
# type flag | |
MB_OK = 0 | |
MB_OKCANCEL = 1 | |
MB_ABORTRETRYIGNORE = 2 | |
MB_YESNOCANCEL = 3 | |
MB_YESNO = 4 | |
MB_RETRYCANCEL = 5 | |
# return values | |
IDOK = 1 | |
IDCANCEL = 2 | |
IDABORT = 3 | |
IDRETRY = 4 | |
IDIGNORE = 5 | |
IDYES = 6 | |
IDNO = 7 | |
def Win32API.MessageBox(wnd, text, caption, type = MB_OK) | |
messagebox = Win32API.new('user32', 'MessageBox', %w(p p p i), 'i') | |
messagebox.call(wnd, text, caption, type) | |
end | |
def Win32API.MessageBoxEx(wnd, text, caption, type = MB_OK, languageid = 0) | |
messagebox = Win32API.new('user32', 'MessageBoxEx', %w(p p p i i), 'i') | |
messagebox.call(wnd, text, caption, type, languageid) | |
end | |
end | |
p Win32API.MessageBox(0, "test message", "test caption") | |
p Win32API.MessageBoxEx(0, "test message", "test caption") | |
p Win32API.MessageBox(0, "てすと", "テスト") | |
p Win32API.MessageBoxEx(0, "てすと", "テスト") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment