Hey Everyone,
Tough one here. Not my code, but I'm helping a friend.
Basically, she wants to get a list of Printer Fonts. In VB6 this is done using the EnumFontFamilies API call, which calls back a function in your VB App.
We cannot get this to work in VB.NET I *think* that the problem may lie in our structure definitions for two Structures that get used by EnumFontFamProc (LOGFONT and NEWTEXTMETRIC)
Anyways, I'd appreciate any advice anyone's got for us.
Thanks!
--Ben
See attached code. To trigger, just set mPrinter equal to the name of the printer (from PrintDialog box) and run the FillFonts function (like below):
Code:Dim f As String Dim prtdlg As PrintDialog = New PrintDialog prtdlg.PrinterSettings = New Printing.PrinterSettings If prtdlg.ShowDialog = DialogResult.OK Then 'Dim MyFonts As New cFonts(prtdlg.PrinterSettings.PrinterName) EnumPrintFonts.mPrinter = prtdlg.PrinterSettings.PrinterName EnumPrintFonts.FillFonts() Me.lbFontList.Items.Clear() For Each f In EnumPrintFonts.mFonts Me.lbFontList.Items.Add(f) Next End If




Reply With Quote