IFEX DEBUG_PECMD.LOG, LOGS *DEBUG_PECMD.LOG 
TEAM ENVI^ EnviMode=1| ENVI^ ForceLocal=1
TEAM SET &SRC=

SET-env  &SRC=%SystemRoot%\System32\SHELL32.DLL //默认配置 
//SET-env  &SRC=%MyName%   //DEBUG  
//SET-env  &SRC=%SystemRoot%\System32\PECMD.NTR //默认配置 
SET  WM_SIZE=0x0005
SET SIZE_MAXHIDE=4
SET SIZE_MAXSHOW=3
SET SIZE_MAXIMIZED=2
SET SIZE_MINIMIZED=1
SET SIZE_RESTORED=0

SET  &WM_LBUTTONDOWN=0x0201
SET  &WM_LBUTTONUP=0x0202
SET  &WM_LBUTTONDBLCLK=0x0203
SET  &WM_RBUTTONDOWN=0x0204
SET  &WM_RBUTTONUP=0x0205


LOAD %CurFile%.ini   //自定义配置 

WIN1 

_SUB WIN1,W500H550,浏览图标 PECMD%PECMDVER%,OnClose,,,, -maxb -size 
    TEAM SET &I0=0| SET &PAGES=100| SET &I=0| SET &NX=| SET &NUM=0| SET &NUMx=| SET &W=730| SET &H=520| SET &y0=0| SET &x0=0| SET &w0=0| SET &bs=1| SET &TT=0| SET &step=1
    TEAM SET &TAG=#| SET &IMAGFLAG=IMAG -numicong| SET-def hv=0|  SET-def IDX=0
    CHEK &IGROUP,L38T3W60H30,组,CALL OnGroup,1
    ITEM &ITEM1,L105T2W60H30,下一页,CALL OnNext,
    ITEM &ITEM2,L229T1W60H30,上一页,CALL OnPre,
    ITEM &ITEM3,L335T2W60H30,文件,CALL OnFile,
    ENVI @this=浏览图标 PECMD%PECMDVER% [%SRC%]
    ENVI @this.MSG=%&WM_SIZE%::&&wParm,&&lParm,CALL OnSize_WIN1 %&wParm%  %&lParm% 
    //ENVI @this.MSG=%WM_LBUTTONUP%::&&wParm,&&lParm,  CALL OnNext      
    //ENVI @this.MSG=%WM_RBUTTONUP%::&&wParm,&&lParm,  CALL OnPre 
    IMAG -numicong NUM,L77T105W32H32,%SRC%,
    IMAG -numicon  NUM2,L31T58W32H32,%SRC%,
    IMAG -numbmp   NUM3,L22T105W32H32,%SRC%,
    LABE -vcenter LBX,L412T2W60H30,,,
    //MESS ICONGROUP=%NUM%   ICON=%NUM2% BMP=%NUM3% 
    //IMAG -numicon  NUM,L31T58W32H32,%SRC% ,
    //IFEX $1=%&IGROUP.Check%,! TEAM SET TAG=###| SET IMAGFLAG=IMAG -numicon NUMx,| SET NUM=0xFFFF
    //IMAG &IMAG%I%,L100T100W32H32,%SRC%%TAG%1,,#0xFF00FF,
    //IMAG &IMAG200,L100T100W32H32,%SRC%%TAG%200,,#0xFF00FF,
    //ENVI @&IMAG200.*del=
    CALL  OnInit  //第一次
_END   

//
_SUB OnClose
    CALC #IDX=%IDX% + 1
_END 

_SUB OnGroup
    WAIT 1
    CALC #IDX=%IDX% + 1
    IFEX $1=%&IGROUP.Check%, TEAM SET TAG=#| SET IMAGFLAG=IMAG -numicong NUMx,! TEAM SET TAG=###| SET IMAGFLAG=IMAG -numicon NUMx,| SET NUM=0xFFFF
    CALL  OnInit1 
_END
_SUB OnInit1 
    %IMAGFLAG% L%xi%T%yi%W32H32,%SRC% 
    IFEX $1<>%&IGROUP.Check%,  MSTR NUM=<2>%NUMx%!  SET NUM=
    FIND $%NUM%=,
    {   TEAM MSTR NUM=<1>%NUMx%
	IFEX $1<>%&IGROUP.Check%, CALC #NUM=%NUM% + 500
    }
//THREAD    MESS [%NUMx%] NUM=%NUM%   IMAGFLAG=[%IMAGFLAG%] TAG=[%TAG%]  IGROUP.Check=[%&IGROUP.Check%]
    CALC I0=0 - %PAGES%
    CALL OnNext // OnPic 
_END
      
_SUB OnInit 
    ENVI @this.POS=?x:y:w:h:x0:y0
    CALC x0=%x0% + 2
    CALC y0=%y0% + 2 + 30 
    CALC w0=%x0% + %x0% - 10
    CALC #&&w=480 + %w0%  
    CALC #&&h=480 + %y0%  + 30  
    ENVI @this.POS=::%w%:%h% 
    CALL  OnGroup 
_END

_SUB OnNext 
    WAIT 1
    CALC #IDX=%IDX% + 1
    SET-def idy=%IDX%
    SET-def hv=0
    DATE &&t0 uptime 
    LOOP $%hv%:%idy%=0:%IDX%,
    {   CALC &&I02=%I0% + %PAGES%
        IFEX $%I02% >= %NUM%, EXIT  _SUB
        TEAM SET I0=%I02%| CALL OnPIC
    }
_END

_SUB OnPre  
    WAIT 1
    CALC #IDX=%IDX% + 1
    SET-def idy=%IDX%
    SET-def hv=0
    DATE &&t0 uptime 
    LOOP $%hv%:%idy%=0:%IDX%,
    {   IFEX $%I0% < 1 , EXIT  _SUB
        TEAM CALC I0=%I0% - %PAGES%| IFEX $%I0%<0, SET I0=0| CALL OnPIC
    }
_END

_SUB  OnFile
    WAIT 1
    CALC #IDX=%IDX% + 1
    BROW &&dirp,%&SRC%,请选择一个EXE/DLL
    FIND $X=X%dirp%, EXIT 
    SET SRC=%dirp% 
    ENVI @this=浏览图标 PECMD%PECMDVER% [%SRC%]
    CALL  OnInit1 
_END

_SUB  OnPic
    ENVI @LBX=%I0%
    ENVI @this.POS=?x:y:w:h  //:x0:y0
    CALC #w=  %w% - %w0% 
    CALC #&NX= %&w% / 48  
    SET I=%PAGES%
    lOOP #%I% > 0,
    {   CALC I=%I% - 1
        ENVI @&IMAG%I%.*del=
        ENVI @&LABE%I%.*del=
    }
    SET I=0
    lOOP #%I% < %PAGES% ,
    {*
        CALC &&II=%I0% + %I% 
        CALC #&&xi=%x0% + ( ( %I% / 1) % %NX% ) * 48
        CALC #&&yi=%y0% + ( ( %I% / 1) / %NX% ) * 48
        CALC #&&y2=%yi% + 32 
        CALC #&&LN= %I% / %NX%
        ENVI &&=POS:i=%I% LN=%LN% xi=%xi% yi=%yi% 
        IMAG &IMAG%I%,L%xi%T%yi%W32H32,%SRC%%TAG%%II%,,#0xFF00FF,
        ENVI @&IMAG%I%.stat=&&v
        IFEX $0<>%v%,TEAM SET hv=1| LABE -center &LABE%I%,L%xi%T%y2%W32H16,%II% 
        CALC I=%I% + 1
    }
    set bs=1
    ENVI @LBX=
    WAIT 1
_END

_SUB OnSize_WIN1
   FIND $1=%bs%,! exit 
   TEAM SET &sz=0 
   IFEX $%1 = %&SIZE_MAXIMIZED%, ENVI &sz=1
   IFEX $%1 = %&SIZE_MAXSHOW%, ENVI &sz=1
   IFEX $%1 = %&SIZE_RESTORED%, ENVI &sz=1
   IFEX $1=%&sz%,
   {
        ENVI @this.POS=?::&&w1:&&h1
        CALC #&w1= %&w1% - %x0%
        CALC #&h1= %&h1% - %y0% 
        IFEX $%w%=%w1%,!! IFEX $%h%=%h1%, exit  _SUB 
        SET w=%w1% 
        SET h=%h1% 
        CALL OnPIC  
        // ENVI @&IMAG1.update=%w%:%h%  //;%FN%  //更新大小
   }    
_END



