- Code: Select all Expand view RUN
#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