Comment convertir std :: wstring en LPCTSTR en C ++?

J'ai Windows valeur de clé de registre dans wstring format. Maintenant, je veux passer à ce code (premier argument de chemin de javaw.exe):

std::wstring somePath(L"....\\bin\\javaw.exe");

    if (!CreateProcess("C:\\Program Files\\Java\\jre7\\bin\\javaw.exe", <--- here should be LPCTSTR, but I have a somePath in wstring format..
            cmdline, //Command line.
            NULL, //Process handle not inheritable.
            NULL, //Thread handle not inheritable.
            0, //Set handle inheritance to FALSE.
            CREATE_NO_WINDOW, //ON VISTA/WIN7, THIS CREATES NO WINDOW
            NULL, //Use parent's environment block.
            NULL, //Use parent's starting directory.
            &si, //Pointer to STARTUPINFO structure.
            &pi)) //Pointer to PROCESS_INFORMATION structure.
    {
        printf("CreateProcess failed\n");
        return 0;
    }

Comment puis-je le faire?

source d'informationauteur Ernestas Gruodis