Problem with ShellExecute

Hello,

I build a new Windows Form Application. In the constructor I get a value from the registry and store them in a member variable:

private: String^ SrcPath;
.
.
.
this
->SrcPath = rk->GetValue("SrcPath")->ToString();

Now, if the user click a button e.g. play, it should open an .exe file. I do this like that:

ShellExecute(NULL, TEXT("open"), TEXT("game.exe"), NULL, this->SrcPath, SW_SHOW);
Application::Exit();


But I geht this error: c:\game\launcher\Form1.h(154) : error C2664: 'ShellExecuteW' : cannot convert parameter 5 from 'System::String ^' to 'LPCWSTR'

I know where the error is, but I don't know how to fix it.

Thanks.

detrix


Answer this question

Problem with ShellExecute