#code=936T950
ENVI^ EnviMode=1
ENVI^ ForceLocal=1
SET$ &NL=0d 0a
SET &EM_GETSEL=0x00B0
SET &EM_SETSEL=0x00B1
SET &EM_REPLACESEL=0x00C2

SET &WM_LBUTTONDOWN=0x0201
SET &WM_LBUTTONUP=0x0202

CALL @Calc_exe

_SUB Calc_exe,W536H628,计算器,
    ENVI @this.Font=13:微软雅黑
    ENVI &&Top=130
//    \%&NL%ProcessorFamily: Intel® Core™ i5 processor
    ENVI &LogInfosShow=
    \ProcessorVersion: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz
    \%&NL%ProcessorType: Central Processor
    \%&NL%ProcessorFamily: IntelR CoreT i5 processor
    \%&NL%ProcessorSocketDesignation: SOCKET 0
    \%&NL%ProcessorManufacturer: Intel(R) Corporation
    \%&NL%ProcessorExternalClock: 100MHz
    \%&NL%ProcessorCurrentSpeed: 3000MHz
    \%&NL%ProcessorUpgrade: Socket LGA1155
    \%&NL%Processor_Caches: L1: 256.00KB; L2: 1.00MB; L3: 6.00MB
    \%&NL%ProcessorCoreCount: 4
    \%&NL%ProcessorCoreEnabled: 4
    \%&NL%ProcessorThreadCount: 4

    MEMO-+ -rich &&EC,L15T%&&Top%W460H(480 - %&&Top% - 6 - 4),%&LogInfosShow%,,0x200

    //LABE LABE1,L11T146W409H30,,,
    ENVI @this.MSG=+%&WM_LBUTTONDOWN%: OnMouse d
    ENVI @this.MSG=+%&WM_LBUTTONUP%: OnMouse u
    LABE -mod -vcenter -center &&I1,L66T73W60H30,移到3, 
    LABE -mod -vcenter -center &&I2,L170T73W60H30,移到7,
    LABE -mod -vcenter -center &&I2,L281T73W60H30,查询,TEAM GetPos &&EC &&v1 &&v2|ENVI @LABE1=位置 %&v1% %&v2%
    ENVI @this.MSG=#1: OnInit
    ENVI @this.POSTMSG=#1
_END

//保存为UniCode 则可以显示
_SUB OnInit  //显示特殊字符
    ENVI @&&EC.SENDMSG=%EM_SETSEL%,0x71,0x78
    ENVI @&&EC.SENDMSG=%EM_REPLACESEL%,7,$® Core™   //®™
_END

_SUB OnInit_2  //显示特殊字符
    ENVI @&&EC.SENDMSG=%EM_SETSEL%,0x71,0x72
    ENVI @&&EC.SENDMSG=%EM_REPLACESEL%,1,$®   //®
    ENVI @&&EC.SENDMSG=%EM_SETSEL%,0x77,0x78
    ENVI @&&EC.SENDMSG=%EM_REPLACESEL%,1,$™   //™可以显示
_END

_SUB OnMouse 
	ENVI @this.Cur=?&&X;&&Y;&&cX;&&cY
	TryIt  66 73 60 30 %1 TEAM Set_Color &&I1| SetPos &&EC 3 3
	TryIt 170 73 60 30 %1 TEAM Set_Color &&I2| SetPos &&EC 7 7
	TryIt 281 73 60 30 %1 TEAM Set_Color &&I3| GetPos &&EC &&v1 &&v2|ENVI @LABE1=位置 %&v1% %&v2%
_END

_SUB Set_Color
	TEAM ENVI @%~1.bkcolor=0xDF0029| WAIT 20| ENVI @%~1.bkcolor=-1|
_END

_SUB TryIt  
	ENVI &&X1=%1
	ENVI &&Y1=%2
	ENVI &&W=%3
	ENVI &&H=%4
	CALC &&X2=%X1% + %W%
	CALC &&Y2=%Y1% + %H%
      MSTR &cmd=<6->%*
	IFEX $%&cX%>%&X1%,!! IFEX $%&cX%<%&X2%,!! IFEX $%&cY%>%&Y1%,!! IFEX $%&cY%<%&Y2%,!! FIND $%5<>d, %&cmd%
_END

// GetPos  EditName PosStart PosEnd
_SUB GetPos
    SET$# &D1=*8 0
    SET$# &D2=*8 0
    ENVI @%1.SENDMSG=%EM_GETSEL%,@&D1,@&D2
    ENVI?long &D1=&&v1
    ENVI?long &D2=&&v2
    ENVI-ret  %~2=%&v1%
    ENVI-ret  %~3=%&v2%
_END

// GetPos  EditName PosStart PosEnd
_SUB SetPos
    SET &d2=%~3
    FIND $%&d2%=, SET &d2=%~2
    ENVI @%1.POSTMSG=%EM_SETSEL%,%~2,%d2%
_END
