View Single Post
  #3 (permalink)  
Old 03-27-2007, 02:59 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 297
Karpagarajan is on a distinguished road
Thumbs up Re: VC++ Tips & Tricks

Hi All,

Here is the tip for TCHAR conversion in Visual C++. I have given the sample conversion program source code.
TCHAR convertion
TCHAR szCurDir[MAX_PATH];
wsprintf(szCurDir,"%s",dFile);

szCurDir[dFile.GetLength()+1]='\0';

USHORT m_Length = strlen(szCurDir);

WCHAR *m_Buffer = (LPWSTR)malloc((m_Length + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szCurDir, m_Length, m_Buffer, m_Length);
m_Buffer[m_Length] = L'\0';
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Booom : 08-09-2007 at 04:37 AM.
Reply With Quote