Hi Miguel,

contrib/hbwin

Note that there are already almost exactly the same
functions (except the encoding setting) for ANSI/WIDE
conversion in win_ole.c. You may want to take a look
at them.

Maybe the best would be to have all these Win text
conversions gathered in one .c file.

Brgds,
Viktor

On 2008.10.21., at 21:30, Miguel Angel Marchuet wrote:

Many thks for you help.

I like too upload this function and other similars to harbour's cvs

Where do you think is the best site to upload it ?

Best regards,
Miguel Angel Marchuet

Przemyslaw Czerpak escribió:

On Tue, 21 Oct 2008, Miguel Angel Marchuet wrote:

Hi Miguel,


Is possible, what do you thing about this function.
Can i use hb_retclenAdopt instead of hb_retclenAdoptRaw in this case ?
or is necessary ?

You have to and in this case you should 1-st fix the conversion code
or it may cause unexpected results like GPF.

Below is corrected version (not tested just written).

best regards,
Przemek


HB_FUNC( UTF8TOWIDE )  // ( cAnsiStr ) -> cWideStr
{
   char *cString = hb_parc( 1 );

   if( cString )
   {
      DWORD length;
      wchar_t * wString;

length = MultiByteToWideChar( CP_UTF8, 0, cString, -1, NULL, 0 ); wString = ( wchar_t * ) hb_xgrab( ( length + 1 ) * sizeof( wchar_t ) ); MultiByteToWideChar( CP_UTF8, 0, cString, -1, wString, length + 1 ); hb_retclen_buffer( ( char * ) wString, length * sizeof( wchar_t ) );
   }
}
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

__________ Informaci�n de ESET Smart Security, versi�n de la base de firmas de virus 3543 (20081021) __________

ESET Smart Security ha comprobado este mensaje.
http://www.eset.com




_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to