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.
li_ScreenH = PixelsToUnits(le_Env.ScreenHeight, YPixelsToUnits!)
li_ScreenW = PixelsToUnits(le_Env.ScreenWidth, XPixelsToUnits!)
if le_env.screenheight=480 then
messagebox("提示信息","系统分辨率为640*480")
elseif le_env.screenheight = 600 then
messagebox("提示信息","系统分辨率为800*600")
elseif le_env.screenheight = 768 then
messagebox("提示信息","系统分辨率为1024*768")
elseif le_env.screenheight = 864 then
messagebox("提示信息","系统分辨率为1152*864")
elseif le_env.screenheight = 1024 then
messagebox("提示信息","系统分辨率为1280*1024")
end if
*****注le_env为系统环境对象,当系统分辨率为800*600时le_env.screenweight = 800,le_env.screenheight=600,do you understand?
试试看行不行?????????????????