Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #property strict
- #import "user32.dll"
- // build 509 まで
- // int MessageBoxA(int hWnd, string lpText, string lpCaption, int uType);
- // build 600 以降
- // いままで string でつかえていたものは char& [] として宣言しないといけない
- int MessageBoxA(int hWnd, char &lpText[], char &lpCaption[], int uType);
- // Win32API なら、 W 版の関数を使うのが良い
- int MessageBoxW(int hWnd,string lpText,string lpCaption,int uType);
- #import
- void start()
- {
- string title = "Title";
- string message = "Message";
- // build 600 以降は string が Unicode (UTF-16) 文字列なので、
- // ANSI 文字列にしてあげる必要がある
- char ansiTitle[];
- StringToCharArray(title, ansiTitle);
- char ansiMessage[];
- StringToCharArray(message, ansiMessage);
- // 引数には、 StringToCharArray で変換した後の char[] 変数を渡してあげないといけない
- MessageBoxA(0, ansiMessage, ansiTitle, 0);
- // Win32API の場合、 W 版を使うとそのまま string が渡せる
- MessageBoxW(0, message, title, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement