|
如果要简单的例子,可以在精华区找到!
或者在LIB下面可以找到带自的.以下是LIB的一个例子
public const BLACK = 0;
public const DARK_GRAY = 8421504;
public const MAROON = 128;
public const OLIVE_GREEN = 32896;
public const GREEN = 32768;
public const GRAY_GREEN = 8421376;
public const PURPLE = 8388608;
public const GRAPE = 8388736;
public const KHAKI = 4227200;
public const FOREST_GREEN= 4210688;
public const PERIWINKLE = 16744448;
public const SLATE = 8404992;
public const VIOLET = 16711744;
public const BROWN = 16512;
public const WHITE = 16777215;
public const LIGHT_GRAY = 12632256;
public const RED = 255;
public const YELLOW = 65535;
public const CHARTREUSE = 65280;
public const AQUA = 16776960;
public const ROYAL_BLUE = 16711680;
public const FUSCHIA = 16711935;
public const PALE_YELLOW = 8454143;
public const LIME_GREEN = 8453888;
public const MINT = 16777088;
public const LAVENDER = 16744576;
public const MAGENTA = 8388863;
public const APRICOT = 4227327;
#Replay function for color selection.
public function select_color (obj,color)
{
auto w,h,hg[],w1,hWnd,hdc,f,i,nXPos,nYPos,c;
obj_get_info(obj,"handle",hWnd);
obj_get_info(obj,"width",w);
obj_get_info(obj,"height",h);
hg[1]=int(h/4);
hg[2]=int(3*(h/4));
#getting the dimensions of a color rectangle
w1=int (w/16);
hdc=GetDC(hWnd);
f=1;
#Scanning the color object to find the requested color. Getting current color under a pixel
#by the WinAPI GetPixel function.
for (i=1;(f>0) && (i<=2) ;i++){
for (nXPos=2.5*w1 ; (f>0) && (nXPos<w) ; nXPos+=w1){
nYPos =hg[i];
c=GetPixel(hdc,nXPos,nYPos);
if (c==color){
#When color found, clicking at the spot to select.
obj_mouse_click (obj, nXPos, nYPos, LEFT);
f=0;
}
}
}
ReleaseDC(hWnd,hdc);
}
#############################################################
public function prepare_cust_rec()
{
auto os,version, dll_path, my_app;
GUI_get_name( os, version );
load ("win32api",1,1);
dll_path = getvar("testname") &"\\reccolor.dll";
load_dll(dll_path);
if ( os == "Windows NT" || os == "Windows 2000" )
my_app = "AfxWnd42u";
else
my_app = "AfxWnd";
set_class_map(my_app, "object");
set_record_attr(my_app, "class regexp_MSW_class label", "attached_text MSW_id MSW_class", "location");
set_record_method(my_app, RM_RECORD);
add_cust_record_class(my_app, dll_path, "my_HLrec", "", "", "", "");
} |
|