1 #include "App_cpPipelineEditor.h"
3 #include <QApplication>
5 // -------------------------------------------------------------------------
6 int main( int argc, char* argv[] )
8 QApplication a( argc, argv );
9 App_cpPipelineEditor w( argc, argv, NULL );
15 // -------------------------------------------------------------------------
25 class Win32CommandLineConverter
28 std::unique_ptr< char*[ ] > argv_;
29 std::vector< std::unique_ptr< char[ ] > > storage_;
32 Win32CommandLineConverter( )
34 LPWSTR cmd_line = GetCommandLineW( );
36 LPWSTR* w_argv = CommandLineToArgvW( cmd_line, &argc );
37 argv_ = std::unique_ptr< char*[ ] >( new char*[ argc ] );
38 storage_.reserve( argc );
39 for( int i = 0; i < argc; ++i )
41 storage_.push_back( ConvertWArg( w_argv[ i ] ) );
42 argv_[ i ] = storage_.back( ).get( );
49 return( static_cast< int >(storage_.size( ) ) );
53 return( argv_.get( ) );
55 static std::unique_ptr< char[ ] > ConvertWArg( LPWSTR w_arg )
57 int size = WideCharToMultiByte(
58 CP_UTF8, 0, w_arg, -1, nullptr, 0, nullptr, nullptr
60 std::unique_ptr< char[ ] > ret( new char[ size ] );
62 CP_UTF8, 0, w_arg, -1, ret.get( ), size, nullptr, nullptr
70 HINSTANCE hPrevInstance,
75 Win32CommandLineConverter cmd_line;
76 return( main( cmd_line.argc( ), cmd_line.argv( ) ) );