Page 1 of 1

Important fix!

PostPosted: Fri Oct 20, 2006 9:15 am
by Antonio Linares
Please add this code to your FWPPC main PRG:
Code: Select all  Expand view
#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

LPSTR WideToAnsi( LPWSTR );

HB_FUNC( GETWINDOWTEXT )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   int iLen = GetWindowTextLength( hWnd );
   LPWSTR pText = ( LPWSTR ) hb_xgrab( ( iLen * 2 ) + 2 );
   LPSTR pAnsi;
   
   GetWindowText( hWnd, pText, iLen + 1 );
   
   pAnsi = WideToAnsi( pText );
   hb_retc( pAnsi );
   hb_xfree( pAnsi );
   hb_xfree( pText );
}   

#pragma ENDDUMP

PostPosted: Fri Oct 20, 2006 10:49 am
by pawelu
Antonio,

What this code change ?

Thanks
Pawel

PostPosted: Fri Oct 20, 2006 12:50 pm
by Antonio Linares
Pawel,

It fixes internal memory corruption. Anyhow a new FWPPC build is coming with more changes.