Any ideas as to why this procedure does not change the printer font?
- Jim
function openprintr() as long
dim lppd as printdlgapi
lppd.lstructsize=len(printdlgapi)
lppd.flags=%pd_returndc or %pd_printsetup
if printdlg(lppd)=0 then
hprinter&=(-1)
textheight&=0
pagelines&=0
pagecount&=0
function=hprinter&
exit function
end if
''devmd&=globallock(lppd.hdevmode)
''dim dev as devmode
''poke$ varptr(dev),peek$(devmd&,len(devmode))
''globalunlock lppd.hdevmode
''device$=dev.dmdevicename
hprinter&=lppd.hdc
pghght&=getdevicecaps(hprinter&,%vertres)
pgwdth&=getdevicecaps(hprinter&,%horzres)
textheight&=pghght&/60 ''tmetrics.tmheight
textwidth&=pgwdth&/80
pagelines&=(pghght&/textheight&)-1
pagecount&=1
dim lgfnt as logfont
''set font
hfont&=getstockobject(%system_fixed_font)
getobject hfont&,len(logfont),lgfnt
lgfnt.lfheight=textheight&
lgfnt.lfwidth=textwidth&
lgfnt.lfweight=400
lgfnt.lfcharset=%oem_charset
''lgfnt.lfoutprecision=%out_default_precis
''lgfnt.lfquality=%draft_quality
''lgfnt.lfpitchandfamily=%fixed_pitch
lgfnt.lffacename="Arial"
hfont&=createfontindirect(lgfnt)
selectobject hprinter&,hfont&
dim docu as docinfo
dim xtext as asciiz*80
ztext="Appname Print Job"
docu.cbsize=sizeof(docu)
docu.lpszdocname=varptr(ztext)
docu.lpszoutput=%null
startdoc hprinter&,docu
function=hprinter&
end function
-------------
Jim Seekamp
- Jim
function openprintr() as long
dim lppd as printdlgapi
lppd.lstructsize=len(printdlgapi)
lppd.flags=%pd_returndc or %pd_printsetup
if printdlg(lppd)=0 then
hprinter&=(-1)
textheight&=0
pagelines&=0
pagecount&=0
function=hprinter&
exit function
end if
''devmd&=globallock(lppd.hdevmode)
''dim dev as devmode
''poke$ varptr(dev),peek$(devmd&,len(devmode))
''globalunlock lppd.hdevmode
''device$=dev.dmdevicename
hprinter&=lppd.hdc
pghght&=getdevicecaps(hprinter&,%vertres)
pgwdth&=getdevicecaps(hprinter&,%horzres)
textheight&=pghght&/60 ''tmetrics.tmheight
textwidth&=pgwdth&/80
pagelines&=(pghght&/textheight&)-1
pagecount&=1
dim lgfnt as logfont
''set font
hfont&=getstockobject(%system_fixed_font)
getobject hfont&,len(logfont),lgfnt
lgfnt.lfheight=textheight&
lgfnt.lfwidth=textwidth&
lgfnt.lfweight=400
lgfnt.lfcharset=%oem_charset
''lgfnt.lfoutprecision=%out_default_precis
''lgfnt.lfquality=%draft_quality
''lgfnt.lfpitchandfamily=%fixed_pitch
lgfnt.lffacename="Arial"
hfont&=createfontindirect(lgfnt)
selectobject hprinter&,hfont&
dim docu as docinfo
dim xtext as asciiz*80
ztext="Appname Print Job"
docu.cbsize=sizeof(docu)
docu.lpszdocname=varptr(ztext)
docu.lpszoutput=%null
startdoc hprinter&,docu
function=hprinter&
end function
-------------
Jim Seekamp
Comment