Przemek

I extend Mindaugus' code as such:

Local cFont := LoadMyFont( "MYFONTRESOURCENAME" )

if !empty( cFont )
   memowrit( 'C:\MyFontFolder\MyFont.fon', cFont  )
endif
if file( 'C:\MyFontFolder\MyFont.fon' )
   WAPI_AddFontResource( 'C:\MyFontFolder\MyFont.fon' )
endif 

HB_GTINFO( HB_GTI_FONTNAME, 'TheNameOfFontInFontFile' )

// Appln Execution

// At Exit
WAPI_RemoveFontResource( 'C:\MyFontFolder\MyFont.fon'  )

#pragma begindump 
#include "windows.h" 
#include "hbapi.h" 
HB_FUNC( LOADMYFONT ) 
{ 
     HGLOBAL  hMem; 
     HRSRC    hRes; 
     DWORD    dwLen; 
     void*    pMem; 

     hRes = FindResource( NULL, hb_parc( 1 ), "MYFONTRESOURCENAME" ); 
     if ( ! hRes ) 
     { 
        hb_ret(); 
        return; 
     } 

     dwLen = SizeofResource( NULL, hRes ); 
     hMem = LoadResource( NULL, hRes ); 
     if ( ! hMem ) 
     { 
        hb_ret(); 
        return; 
     } 

     pMem = LockResource( hMem ); 
     if( ! pMem ) 
     { 
        hb_ret(); 
        return; 
     } 
     hb_retclen( (char*) pMem, dwLen ); 
} 
#pragma enddump 

Regards
Pritpal Bedi



-- 
View this message in context: 
http://www.nabble.com/two-questions-for-windows-guru-tp22119661p22128406.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to