On Thu, 27 Nov 2008, Pritpal Bedi wrote:
Hi Pritpal,
> Now the showstopper: MSDN defines header and lib for the fiunction
> StringCchCat()
> strsafe.h and strsafe.lib
> which is not available with BCC5.8.
> What should I do?
Create it yourself or define your own function or macro with such
functionality. F.e.:
#if !defined( StringCchCat )
#ifdef UNICODE
#define StringCchCat(d,n,s) hb_wcnCpy( (d), (s), (n) - 1 )
#else
#define StringCchCat(d,n,s) hb_strnCpy( (d), (s), (n) - 1 )
#endif
#endif
wchar_t *hb_wcnCpy( wchar_t dstW, const wchar_t *srcW, unsigned long ulLen )
{
ULONG ulDst, ulSrc;
dstW[ ulLen ] = 0;
ulDst = lstrlenW( dstW );
if( ulDst < ulLen )
{
ulSrc = lstrlenW( srcW );
if( ulDst + ulSrc > ulLen )
ulSrc = ulDst - ulDst;
memcpy( &dstW[ ulDst ], srcW, ulSrc * sizeof( wchar_t ) );
dstW[ ulDst + ulSrc ] = 0;
}
return dstW;
}
Fix my possible typos (just written by finger, not tested at all)
add above macro definitions to include/hbwince.h with extern declaration for
hb_wcnCpy() function and then add hb_wcnCpy() body to source/common/hbwince.c
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour