注册 登录
编程论坛 VFP论坛

新人求助,屏幕取色。

jianxianl 发布于 2020-07-14 19:09, 1882 次点击
IF n=1
   DECLARE integer GetPixel IN WIN32API as "GetPixel" integer hDc,integer xPos,integer yPos
   DECLARE integer GetDC IN WIN32API as "GetDC" integer hWnd
   DECLARE integer ReleaseDC IN WIN32API as "ReleaseDC" integer,integer
   hDcScreen=GetDC(0)
   LOCAL xRgbColor as Integer
   xRgbColor=GetPixel(hDcScreen,364,291)
  if int(xRgbColor/65536)=255.and.int((xRgbColor%65536)/256)=255.and.xRgbColor%256=255
    bls="0"
  else
    bls="1"
  endif
  go ff
  do case
     case fff<101
     replace hzb1 with trim(hzb1)+bls
     case fff>100.and.fff<201
     replace hzb2 with trim(hzb2)+bls
     case fff>200.and.fff<301
     replace hzb3 with trim(hzb3)+bls
     case fff>300
     replace hzb4 with trim(hzb4)+bls
  endcase  
  fff=fff+1
  thisform.container1.image1.left=thisform.container1.image1.left-24
  if fff=401
    fff=1
    ff=ff+1
    thisform.container1.image1.top=thisform.container1.image1.top-24
    thisform.container1.image1.left=0
  endif
  ReleaseDC(0,hDcScreen)
  clear dlls
endif

各位老大,这个代码是偶连抄带蒙写出来的。意思就是屏幕取色,写到表里。可执行到第十四条记录失效,怀疑是内存溢出。请各位老大助小弟一臂之力,先谢谢了。
4 回复
#2
sdta2020-07-14 20:24
论坛中就有这个问题的回帖
#3
jianxianl2020-07-14 22:31
不好意思,没找到。能给个链接吗》
#4
sdta2020-07-14 23:18
#5
jianxianl2020-07-16 08:46
谢谢,已借鉴,效果很好。
1