FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Instalar Fuentes en Windows 7 32 bits.
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 01:24 PM
Senõres buén dia, que hago mal, esto no funciona en windows 7 de 32 bits?

Code (fw): Select all Collapse
#Include "FiveWin.ch"

FUNCTION Main ()

   INSTFONTS()

RETURN NIL

FUNCTION INSTFONTS()

   Local lInstala := .F.

   IF .NOT. MsgYesNo( "Instalar Fontes da NF-e no Windows?", ;
                      "Instalar Fontes da NF-e no Windows " )

      RETURN NIL

   ENDIF

   IF FILE( "C:\INST_NFE\GERAPNFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERAONFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERANFE.EXE" ) // PLENOIND

      lInstala := .T.

   ENDIF

   IF lInstala

      CopyFile( "C:\INST_NFE\fontes\Code128bWin.ttf", GetWinDir() + "\Fonts\Code128bWin.ttf", .T. )

      AddFontResource( "C:\INST_NFE\fontes\Code128bWin.ttf" )

      IF FILE( GetWinDir() + "\Fonts\Code128bWin.ttf" )

         MSGWAIT( "As Fontes da NF-e Foram Instalados Com Sucesso..." )

      ELSE

         MSGWAIT( "As Fontes da NF-e Nao Foram Instaladas..." )

         lInstala := .F.

      ENDIF   

   ENDIF   

RETURN NIL

// FIM


Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 02:07 PM

Mira los permisos de usuario para grabar en esa carpeta

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 03:24 PM

Gracias,

Windows dice Acceso denegado.

Saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 05:36 PM

Al desactivar el control de los usuarios de Windows 7, el programa se ejecuta e instala sin problemas.

pregunta:

Tien algun comando que cierre el control del usuarios en windows 7 ?

En windows 8 y 10 no funciona tambien ni deshabilitando el control de usuarios.

Alguna idea?

Gracias, saludos.


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 06:04 PM

Quizas has de tener en cuenta que no solo el usuario ha de tener permisos de administrador, quizás has de darle permisos al ejecutable para que se ejecute con permisos de administrador también, aunque imagino que esto también lo habrás tenido en cuenta

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 06:21 PM
Deshabilitando el control de Usuários, funciona.

Code (fw): Select all Collapse
#Include "FiveWin.ch"
#include "Directry.ch"
#Include "struct.ch"

FUNCTION Main ()

   INSTFONTS()

RETURN NIL

FUNCTION INSTFONTS()

   Local lInstala := .F.

   IF .NOT. MsgYesNo( "Instalar Fontes da NF-e no Windows?", ;
                      "Instalar Fontes da NF-e no Windows " )

      RETURN NIL

   ENDIF

   IF FILE( "C:\INST_NFE\GERAPNFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERAONFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERANFE.EXE" ) // PLENOIND

      lInstala := .T.

   ENDIF

   IF lInstala

      IF .NOT. FILE( GetWinDir() + "\Fonts\Code128bWin.ttf" )

         LZCOPYFILE( "C:\INST_NFE\fontes\Code128bWin.ttf", GetWindir() + "\fonts\Code128bWin.ttf")

         AddFontResource( "C:\INST_NFE\fontes\Code128bWin.ttf" )

         LZCOPYFILE( "C:\INST_NFE\fontes\Code128bWinLarge.ttf", GetWindir() + "\fonts\Code128bWinLarge.ttf")

         AddFontResource( "C:\INST_NFE\fontes\Code128bWinLarge.ttf" )

      ENDIF

      IF FILE( GetWinDir() + "\Fonts\Code128bWin.ttf" )

         MsgWait( "As Fontes da NF-e Foram Instalados Com Sucesso..." )

      ELSE

         MsgWait( "As Fontes da NF-e Nao Foram Instaladas..." )

         lInstala := .F.

      ENDIF

   ENDIF   

RETURN NIL

// Funções AddFontResource e RemoveFontResource, em linguagem C

#pragma BEGINDUMP

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

HB_FUNC ( ADDFONTRESOURCE )
{
    hb_retni( AddFontResource( (LPCSTR) hb_parc(1) ) );
}

HB_FUNC ( REMOVEFONTRESOURCE )
{
    hb_retl( RemoveFontResource( (LPCSTR) hb_parc(1) ) );
}

#pragma ENDDUMP

// FIM


Solo me falta saber como deshabilitar el control de usuario(UAC) del windows 7 8 y 10 jejejejejejeje.

Que dificil.


Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Instalar Fuentes en Windows 7 32 bits.
Posted: Thu Jan 22, 2015 07:52 PM
Resuelto:

Special Thanks,

Alessandro, você é o cara!! Muito obrigado, funciona em windows 7, 8 e 10, nestes 2 últimos, testado pelo Alessandro.

Code (fw): Select all Collapse
#Include "FiveWin.ch"
#include "Directry.ch"

#ifndef XPP
   #define  HKEY_CLASSES_ROOT       2147483648
   #define  HKEY_CURRENT_USER       2147483649
   #define  HKEY_LOCAL_MACHINE      2147483650
   #define  HKEY_USERS              2147483651
   #define  HKEY_PERFORMANCE_DATA   2147483652
   #define  HKEY_CURRENT_CONFIG     2147483653
   #define  HKEY_DYN_DATA           2147483654
#else
   #define  HKEY_CLASSES_ROOT       1
   #define  HKEY_CURRENT_USER       2
   #define  HKEY_LOCAL_MACHINE      3
   #define  HKEY_USERS              4
   #define  HKEY_PERFORMANCE_DATA   5
   #define  HKEY_CURRENT_CONFIG     6
   #define  HKEY_DYN_DATA           7
#endif

FUNCTION AddFonte()

  INSTFONTS()

RETURN NIL

FUNCTION INSTFONTS()

   Local lInstala := .F.

   IF .NOT. MsgYesNo( "Instalar Fontes da NF-e no Windows?", ;
                      "Instalar Fontes da NF-e no Windows " )

      RETURN NIL

   ENDIF

   IF FILE( "C:\INST_NFE\GERAPNFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERAONFE.EXE" ) .OR. ;
      FILE( "C:\INST_NFE\GERANFE.EXE" ) // PLENOIND

      lInstala := .T.

   ENDIF

   IF lInstala

      IF .NOT. FILE( GetWinDir() + "\Fonts\Code128bWin.ttf" )

         // Desligando o UAC do Windows.
         oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" )
         oReg:Set( "EnableLUA", 0 )
         oReg:Close()

         // Assim, o windows explorer mostra as fontes
         LZCOPYFILE( "C:\INST_NFE\fontes\Code128bWin.ttf", GetWindir() + "\fonts\Code128bWin.ttf")

         AddFontResource( "C:\INST_NFE\fontes\Code128bWin.ttf" )

         LZCOPYFILE( "C:\INST_NFE\fontes\Code128bWinLarge.ttf", GetWindir() + "\fonts\Code128bWinLarge.ttf")

         AddFontResource( "C:\INST_NFE\fontes\Code128bWinLarge.ttf" )

         oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" )
         oReg:Set( "EnableLUA", 1 )
         oReg:Close()

      ELSE

         /*
         oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" )

         // Isto nao funcionou em Windows 7 32 bits.
         IF oReg:Get( "EnableLUA" ) == 0
            oReg:Set( "EnableLUA", 1 )
         ENDIF

         oReg:Close()
         */

      ENDIF

      IF FILE( GetWinDir() + "\Fonts\Code128bWin.ttf" )

         MsgWait( "As Fontes da NF-e Foram Instalados Com Sucesso..." )

      ELSE

         MsgWait( "As Fontes da NF-e Nao Foram Instaladas..." )

         MsgInfo( "Desligue o Controle de Usuarios do Windows(UAC)", ;
                  "Desligue o Controle de Usuarios do Windows(UAC)" )

         lInstala := .F.

      ENDIF

   ELSE

      MsgWait( "As Fontes da NF-e Nao Foram Instaladas..." )

      MsgInfo( "PROGRAMA DA NOTA FISCAL NAO LOCALIZADO...", ;
               "PROGRAMA DA NOTA FISCAL NAO LOCALIZADO..." )

      lInstala := .F.

   ENDIF

   lInstala := .F.

RETURN NIL

// Funções AddFontResource e RemoveFontResource, em linguagem C

#pragma BEGINDUMP

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

HB_FUNC ( ADDFONTRESOURCE )
{
    hb_retni( AddFontResource( (LPCSTR) hb_parc(1) ) );
}

HB_FUNC ( REMOVEFONTRESOURCE )
{
    hb_retl( RemoveFontResource( (LPCSTR) hb_parc(1) ) );
}

#pragma ENDDUMP

// FIM


I LOVE FIVEWIN!
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion