FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to convert C++--> CPP ?
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM

How to convert C++--> CPP ?

Posted: Fri Nov 16, 2007 05: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

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How to convert C++--> CPP ?

Posted: Fri Nov 16, 2007 08:34 AM
#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
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM

How to convert C++--&gt; CPP ?

Posted: Fri Nov 16, 2007 11:56 AM

Antonio,
Thank you very much!
Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651

Continue the discussion