and here's a different method taken from Stan Lippman's blog
(
http://weblogs.asp.net/slippman/).
this converts to a char array, which you should easily be able to
convert to LPTCSTR
note that vcclr.h is included
#include <stdlib.h>
#include <vcclr.h>
#include <string>
using namespace System;
bool To_CharStar( String^ source, char*& target )
{
int len = (( source->Length+1) * 2);
target = new char[ len ];
pin_ptr<const wchar_t> wch = PtrToStringChars( source );
return wcstombs( target, wch, len ) != -1;
}
bool To_string( String^ source, string &target )
{
int len = (( source->Length+1) * 2);
char *ch = new char[ len ];
bool result ;
{
pin_ptr<const wchar_t> wch = PtrToStringChars( source );
result = wcstombs( ch, wch, len ) != -1;
}
target = ch;
delete ch;
return result;
}