- Code: Select all Expand view
METHOD Add( cItem, nAt ) CLASS TListBox
DEFAULT nAt := Len( ::aItems )
cItem = FW_AnsiToWide( cItem ) // Nueva !!!
if nAt == Len( ::aItems )
AAdd( ::aItems, cItem )
::SendMsg( LB_ADDSTRING, 0, cItem )
else
ASize( ::aItems, Len( ::aItems ) + 1 )
AIns( ::aItems, nAt + 1 )
::aItems[ nAt + 1 ] = cItem
::SendMsg( LB_INSERTSTRING, nAt, cItem )
endif
::SendMsg( LB_SETCURSEL, nAt )
return nil
Reemplazar todas las llamadas a AnsiToWide() en listbox.prg con FW_AnsiToWide()
Y anadir esta funcion a listbox.prg:
- Code: Select all Expand view
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
LPWSTR AnsiToWide( char * );
HB_FUNC( FW_ANSITOWIDE )
{
LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
int iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, hb_parc( 1 ), -1, 0, 0 );
hb_retclen( ( char * ) pW, ( hb_parclen( 1 ) * 2 ) + 1 );
hb_xfree( pW );
}
#pragma ENDDUMP