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

Problem with ShellExecute
Daniel G
thank you for answer. But it doesn't work. Now I get this error:
c:\game\launcher\Form1.h(159) : error C2440: 'initializing' : cannot convert from 'cli::interior_ptr<Type>' to 'wchar_t *'
with
[
Type=const wchar_t
]
Cannot convert a managed type to an unmanaged type
---
Char * SrcPath = PtrToStringChars(this->SrcPath);
I tried all the examples from the link you post, but nothing work.
wpzhao
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcmxspec/html/vcManagedExtensionsSpec_7_8.asp
Karinita