3 #include <msp/stringcodec/utf16.h>
4 #include <msp/stringcodec/utf8.h>
6 #include "application.h"
12 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
15 LPWSTR *argv_w = CommandLineToArgvW(GetCommandLineW(), &argc);
17 unsigned max_size = 0;
18 for(int i=0; i<argc; ++i)
19 max_size += wcslen(argv_w[i])*4+1;
21 char *argv_buf = new char[max_size+(argc+1)*sizeof(char *)];
22 char **argv = reinterpret_cast<char **>(argv_buf);
23 char *argv_ptr = argv_buf+(argc+1)*sizeof(char *);
24 for(int i=0; i<argc; ++i)
27 string arg(reinterpret_cast<char *>(argv_w[i]), wcslen(argv_w[i])*2);
28 arg = StringCodec::transcode<StringCodec::Utf16Le, StringCodec::Utf8>(arg);
29 copy(arg.begin(), arg.end(), argv_ptr);
30 argv_ptr += arg.size();
35 int exit_code = Msp::Application::run(argc, argv, hInstance);
41 int main(int argc, char **argv)
43 return Msp::Application::run(argc, argv);