GetFileVersionInfo() funcion del api de windows quiero saber como aplicarla en fivewin, si alguien tiene una idea por favor responder...
gracias
// Just for FWH 32 bits
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local n
for n = 1 to 12
MsgInfo( GetFileVersionInfo( "filever.exe", n ) )
next
return nil
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( GETFILEVERSIONINFO )
{
char * szFile = hb_parc( 1 );
UINT uAction = ISNUM( 2 ) ? hb_parni( 2 ) : 1;
DWORD dwHandle = 0;
DWORD dwSize = GetFileVersionInfoSize( szFile, &dwHandle );
char * szOut = NULL;
BOOL bOk = FALSE;
if( dwSize )
{
char * szBlock = ( char * ) hb_xgrab( 255 );
char * szSubBlock = ( char * ) hb_xgrab( 255 );
HGLOBAL hMem = GlobalAlloc( GMEM_MOVEABLE, dwSize );
VS_FIXEDFILEINFO * vsInfo;
UINT nLen = 0;
if( hMem )
{
LPVOID pMem = GlobalLock( hMem );
if( pMem && GetFileVersionInfo( szFile, dwHandle, dwSize, pMem ) )
{
if( VerQueryValue( pMem, "\\VarFileInfo\\Translation", ( LPVOID * ) &vsInfo, &nLen ) )
{
*( LPDWORD ) vsInfo = MAKELONG( HIWORD( *( LPDWORD ) vsInfo ), LOWORD( *( LPDWORD ) vsInfo ) );
sprintf( szBlock, "\\StringFileInfo\\%08lx\\", *( LPDWORD )( vsInfo ) );
switch( uAction )
{
case 1:
sprintf( szSubBlock, "%s%s", szBlock, "Comments" );
break;
case 2:
sprintf( szSubBlock, "%s%s", szBlock, "CompanyName" );
break;
case 3:
sprintf( szSubBlock, "%s%s", szBlock, "FileDescription" );
break;
case 4:
sprintf( szSubBlock, "%s%s", szBlock, "FileVersion" );
break;
case 5:
sprintf( szSubBlock, "%s%s", szBlock, "InternalName" );
break;
case 6:
sprintf( szSubBlock, "%s%s", szBlock, "LegalCopyright" );
break;
case 7:
sprintf( szSubBlock, "%s%s", szBlock, "LegalTrademarks" );
break;
case 8:
sprintf( szSubBlock, "%s%s", szBlock, "OriginalFilename" );
break;
case 9:
sprintf( szSubBlock, "%s%s", szBlock, "PrivateBuild" );
break;
case 10:
sprintf( szSubBlock, "%s%s", szBlock, "ProductName" );
break;
case 11:
sprintf( szSubBlock, "%s%s", szBlock, "ProductVersion" );
break;
case 12:
sprintf( szSubBlock, "%s%s", szBlock, "SpecialBuild" );
break;
}
if( VerQueryValue( pMem, szSubBlock, ( LPVOID * ) &szOut, &nLen ) )
bOk = TRUE;
hb_xfree( szBlock );
hb_xfree( szSubBlock );
}
GlobalUnlock( hMem );
GlobalFree( hMem );
}
}
}
if( bOk )
hb_retc( szOut );
else
hb_retc( "" );
}
#pragma ENDDUMP
//----------------------------------------------------------------------------//
Return to FiveWin for CA-Clipper
Users browsing this forum: No registered users and 6 guests