MultiByteToWideChar = Win32API.new("kernel32","MultiByteToWideChar","llplpl","l")
WideCharToMultiByte = Win32API.new("kernel32","WideCharToMultiByte","llplplll","l")
UTF8 = 0xFDE9
CPACP = 0
def utf8ToAnsi(str)
  len = MultiByteToWideChar.call(UTF8, 0, str, -1, "", 0)
  buf = "00" * len
  MultiByteToWideChar.call(UTF8, 0, str, -1, buf, len)
  len = WideCharToMultiByte.call(CPACP, 0, buf, -1, "", 0, 0, 0)
  retbuf = "0" * len
  WideCharToMultiByte.call(CPACP, 0, buf, -1, retbuf, len, 0, 0)
  retbuf
end

title = utf8ToAnsi("测试")
c=Win32API.new("user32","CreateWindowExA","LppLllllllll","l")
p c.call(0,"Button",title,0x10000000 | 0x00040000,400,400,250,150,0,0,0x400000,0)