Esattamente devo proprio installare i font dei codici a barre, ed il problema è proprio la ristrettezza dell'account.
Da VB6 sono sicuro che ci si possa, questo è il codice:
________________________________________________
Declare Function WriteProfileString Lib "Kernel" (ByVal _
lpApplicationName As String, ByVal lpKeyName As String, _
ByVal lpString As String) As Integer
Declare Function CreateScalableFontResource% Lib "GDI" _
(ByVal fHidden%, ByVal lpszResourceFile$, ByVal _
lpszFontFile$, ByVal lpszCurrentPath$) Declare Function _
AddFontResource Lib "GDI" (ByVal lpFilename As Any) As _
Integer
Declare Function SendMessage Lib "User" (ByVal hWnd As _
Integer, ByVal wMsg As Integer, ByVal wParam As _
Integer, lParam As Any) As Long
Sub Install_TTF (FontName$, FontFileName$, WinSysDir$)
Dim Ret%, Res&, FontPath$, FontRes$
Const WM_FONTCHANGE = &H1D
Const HWND_BROADCAST = &HFFFF
FontPath$ = WinSysDir$ + "\" + FontFileName$
FontRes$ = Left$(FontPath$, Len(FontPath$) - 3) + "FOT"
Ret% = CreateScalableFontResource(0, FontRes$, _
FontFileName$, WinSysDir$)
Ret% = AddFontResource(FontRes$)
Res& = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
Ret% = WriteProfileString("fonts", FontName + " " & _
"(TrueType)", FontRes$)
End Sub
_________________________________________
Ma purtroppo non ho VB6 ma solo VB 2008 Express e VBA in ACCESS.
Quando provo il debug, anche a casa mia dove sono l'amministratore, l'applicazione mi va in errore perché non riesce a far riferimento alle librerie Kernel, User e GDI che sono tutte librerie API.
Ritorno alla domanda iniziale quindi:
Qualcuno sa se è possibile utilizzare le librerie API in VB 2008 Express o in VBA per ACCESS, oltre ovviamente a VB6 che le ha già preinstallate?
Grazie comunque agli altri per l'interessamento.

Rispondi quotando