'////////////////////////////////
'//
'//griefforyou收集整理
'//
'////////////////////////////////
private declare function getdevicecaps lib "gdi32" (byval hdc as long, byval nindex as long) as long
private declare function changedisplaysettings lib "user32" alias "changedisplaysettingsa" (lpdevmode as any, byval dwflags as long) as long
private const ccdevicename as long = 32
private const ccformname as long = 32
private const dm_bitsperpel as long = &h40000
private const dm_pelswidth as long = &h80000
private const dm_pelsheight as long = &h100000
private const dm_displayflags as long = &h200000
private const dm_displayfrequency = &h400000
private const cds_force as long = &h80000000
private const bitspixel as long = 12
private const horzres as long = 8
private const vertres as long = 10
private const vrefresh = 116
private type devmode
dmdevicename as string * ccdevicename
dmspecversion as integer
dmdriverversion as integer
dmsize as integer
dmdriverextra as integer
dmfields as long
dmorientation as integer
dmpapersize as integer
dmpaperlength as integer
dmpaperwidth as integer
dmscale as integer
dmcopies as integer
dmdefaultsource as integer
dmprintquality as integer
dmcolor as integer
dmduplex as integer
dmyresolution as integer
dmttoption as integer
dmcollate as integer
dmformname as string * ccformname
dmunusedpadding as integer
dmbitsperpel as integer
dmpelswidth as long
dmpelsheight as long
dmdisplayflags as long
dmdisplayfrequency as long
end type
private sub cmdchangedesktopmode_click()
dim dm as devmode
with dm
.dmpelswidth = cint(txtnewwidth.text)
.dmpelsheight = cint(txtnewheight.text)
.dmbitsperpel = cint(txtnewcolor.text)
.dmdisplayfrequency = cint(txtnewfreq.text)
.dmfields = dm_pelswidth or dm_pelsheight or dm_bitsperpel or dm_displayfrequency
.dmsize = lenb(dm)
end with
if changedisplaysettings(dm, cds_force) <> 0 then
msgbox "错误!不支持此模式!"
end if
end sub
private sub form_load()
txtoldwidth.text = getdevicecaps(me.hdc, horzres)
txtoldheight.text = getdevicecaps(me.hdc, vertres)
txtoldcolor.text = getdevicecaps(me.hdc, bitspixel)
txtoldfreq.text = getdevicecaps(me.hdc, vrefresh)
end sub
新闻热点
疑难解答