Flag Meaning 0 The graphics mode for the current screen will be changed dynamically.
CDS_UPDATEREGISTRY The graphics mode for the current screen will be changed dynamically and the graphics mode will be updated in the registry. The mode information is stored in the USER profile.
CDS_TEST The system tests if the requested graphics mode could be set.
答:局部外部函数声明
[Local external function declaration]
FUNCTION long ChangeDisplaySettingsA (ref devmode lpst, ulong Flags) &
LIBRARY "USER32.DLL"
结构体声明
[structure definition, devmode]
character dmdevicename[32]
integer dmspecversion
integer dmdriverversion
integer dmsize
integer dmdriverextra
long dmfields
integer dmorientation
integer dmpapersize
integer dmpaperlength
integer dmpaperwidth
integer dmscale
integer dmdefaultsource
integer dmprintquality
integer dmcolor
integer dmduplex
integer dmresolution
integer dmttoption
integer dmcollate
character dmformname[32]
integer dmlogpixels
long dmbitsperpel
long dmpelswidth
long dmpelsheight
long dmdisplayflags
long dmdisplayfrequency
long dmicmmethod
long dmicmintent
long dmmediatype
long dmdithertype
long dmreserved1
long dmreserved2
实例变量声明
[Instance variable declaration]
Ulong CDS_FORCE = 8*16*16*16*16*16*16*16
long DM_BITSPERPEL_H = 4*16*16*16*16
long DM_PELSWIDTH_H = 8*16*16*16*16
long DM_PELSHEIGHT_H = 16*16*16*16*16
long DM_DISPLAYFLAGS_H = 2*16*16*16*16*16
转换到800x600分辨率的脚本
[powerscript to switch to 800x600]
devmode dm
long a
The first function returns the color of a specific pixel(像素;显示器的最小分辨单元). The SetPixel function changes the targeted pixel to the color sent. There is no PowerBuilder equivalent.
Global External Function:
FUNCTION ulong GetPixel(ulong hwnd, long xpos, long ypos) LIBRARY "Gdi32.dll"
FUNCTION ulong SetPixel(ulong hwnd, long xpos, long ypos, ulong pcol) LIBRARY "Gdi32.dll"
Script:
long lx, ly
ulong rtn
ulong l_handle, l_device
lx = 100
ly = 100
l_handle = handle(w_main)
l_device = GetDC(l_handle)
rtn = GetPixel(l_device, 100, 100)
MessageBox("Position " + string(lx) + "," + string(ly),"Color = " + string(rtn))
SetPixel(l_device, lx, ly, 0) // This call will set the pixel at lx, ly to black.