How to convert C++--> CPP ?

How to convert C++--> CPP ?

Postby ShumingWang » Fri Nov 16, 2007 5:14 am

Hi

void BIG52GBK(char *szBuf)
{
  if(!strcmp(szBuf, ""))
   return;
  int nStrLen = strlen(szBuf);
  wchar_t *pws = new wchar_t[nStrLen + 1];
  try
  {
   int nReturn = MultiByteToWideChar(950, 0, szBuf, nStrLen, pws, nStrLen + 1);
   BOOL bValue = false;
   nReturn = WideCharToMultiByte(936, 0, pws, nReturn, szBuf, nStrLen + 1, "?", &bValue);
   szBuf[nReturn] = 0;
  }
  __finally
  {
   delete[] pws;
  }
}

harbour request : HB_FUNC(BIG52GBK)

Regards

Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby Antonio Linares » Fri Nov 16, 2007 8:34 am

Code: Select all  Expand view  RUN
#include <hbapi.h>
#include <windows.h>

HB_FUNC( BIG52GBK )
{
   char * szBuf = hb_parc( 1 );
   int nStrLen = strlen( szBuf );
   LPWSTR pws = ( LPWSTR ) hb_xgrab( ( sStrLen + 1 ) * 2 );
   int nReturn = MultiByteToWideChar( 950, 0, szBuf, nStrLen, pws,         
                                                        nStrLen + 1);
   BOOL bValue = FALSE;

   nReturn = WideCharToMultiByte( 936, 0, pws, nReturn, szBuf,
                                                    nStrLen + 1, "?", &bValue);
   szBuf[ nReturn ] = 0;
   hb_retclen( ( char * ) pws, nReturn );
   hb_xfree( pws );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ShumingWang » Fri Nov 16, 2007 11:56 am

Antonio,
Thank you very much!
Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests