Friday, April 18, 2014

How Convert LPCSTR to LPCTSTR in VC++ (Nothing works)

If Nothing works for you Try this I succeeded

Create a Dummy Helper Structure

typedef struct _tag_myconvhelper
{
    CString myhelper;
}MYCONVHELPER;

In your Program don't forget to include tchar.h and CString

create an object for _tag_myconvhelper

MYCONVHELPER objmyconhelper;

LPCSTR lpszfromstring =_T("This is the String");

objmyconhelper.myhelper = lpszfromstring ;

LPCTSTR lpsztostring = objmyconhelper.myhelper;

Windows automatically converts it for you no need of complex conversion method :-)

No comments:

Post a Comment