|
要制作像Windows窗口界面一样的一键恢复软件必须使用的软件有: QB+QBWIN+IBM+GHOST,才能实现,如下图就是一个简单的一键恢复系统的界面图.我本人就是在N年前在本论坛的关于<<>自制IBM一键恢复系统>一文中学习的,相信有很多人已经制作出自己的一键恢复系统,也有很多人失败,现在我把自己做的代码供大家参考:
===============================================================================
其实制作非常简单,但如果要完整的做好一键恢复软件(包括自动分区,自动安装),工序也很繁琐的!不过只要有心去做一定能完成的,呵呵!
以下是本程序的代码,把这些代码复制到文本文件将后缀名TXT该BAS即可,然后到QB71中去编译为EXE文件,相信N年前已经介绍了QB71的安装和使用,下面我简单说一下:
1.在DOS6.22系统下安装UCDOS或运行TW.EXE汉化系统.
2.安装QB71
3.拷贝QBWIN相关的文件到DOS6.22的QB71目录下(如果你不知道是那些文件那就拷贝QBWIN目录下的所有文件到QB71目录下)
4.运行命令:
C:\DOS\QB7>
键入:
QBX/L QBWIN
===============================================================================
DEFINT A-Z
'-------------------------------------------------------------------
'定义各控件最多可用的数目:
CONST MaxButton = 7 , MaxCheck = 0 , MaxOptG = 0 , MaxOptI = 0
' 按钮 复选按钮 单选按钮(组数),(每组项目数)
CONST MaxFrame = 1 , MaxList = 0 , MaxListItem = 100, MaxText = 1
' 框架 列表框 , 每一列表项目数 文本框
CONST MaxCombo = 0 , MaxLabel = 3 , MaxMainMenu = 0, MaxMenuItem = 5
' 下拉式列表 标签 菜单 菜单项目
CONST MaxPercent = 0 , ListItemBuffer = 64
' 进度条 列表项目大小
CONST ListScrollSpeed = 1 '列表屏幕滚动速度(-1最快)
'$INCLUDE: 'QBWIN.BI'
'$INCLUDE: 'QBWIN.DAT'
SystemInit 1 '系统初始化
'0:不使用中文字库与输入法文件
'1:必须要中文字库文件(QBWIN.FNT),否则程序不能运行
'-1:如果程序找到有中文字库与输入法文件时可以使用,可以不使用
'定义及初始化用户变量区域 ----------------------------
'-----------------------------------------------------
DO
'桌面定义
'格式: DrawDesktop 提示行开关,桌面颜色,提示行字体颜色,背景色,提示文字$
IF ExitWin < 2 THEN DrawDesktop 2, 3, 0, 7, "Ctrl+X:关闭窗口 Ctrl+F1:输入法"
'各表单控件读入区域, 读入各种控件之间用 [=] 表示该种控件读完
SELECT CASE Wins
'sl.QWF
CASE 0:
'格式: LoadWindow X,Y,W,H,Font,BC,Box,TC,Caption
LoadWindow 177,99,285,210,1510,7,-1,9," 一键恢复系统"
RESTORE WIN00
WIN00:
'热键值: Alt+ F1=360 1=376 Q=272 A=286 Z=300
'LoadMenu '读入菜单
'格式: DATA [-,Hotkey,] Enabled,Value,Caption []里的参数为分组用
'DATA -,289,1,0,文件(F)
'DATA 1,0,Menu(1)
'DATA =
'格式: DATA X,Y,W,H,FC,FM,BC,Mode,Caption
LoadFrame 0 '读入框架 是否读入到变量
DATA 15,15,250,150,0,0,-1,7,"功能"
DATA 120,45,130,95,0,0,-1,5,""
DATA =
'格式: DATA X,Y,W,H,Enabled,FC,FW,FH,Hotkey,Caption
LoadButton 0 '读入命令按钮 背景框
DATA 30,45,70,19,-1,9,0,12,-1,"备份(F1)"
DATA 30,80,70,19,-1,12,0,12,-1,"恢复(F2)"
DATA 30,115,70,19,-1,0,0,12,-1,"退出(Esc)"
DATA =
'格式: DATA X,Y,BW,FW,FH,FC,BC,FM,Style,Caption
LoadLabel 0, 0 '读入标签 是否读入到变量, 背景框
DATA 125,60,0,12,12,2,-1,0,0,"本软件由网络游侠制作`版权所有!"
DATA 125,90,0,12,12,2,-1,0,0,"QQ:12345678"
DATA 125,110,0,12,12,2,-1,0,0,"MAIL:wlyx.163.com"
DATA =
END SELECT
IF ExitWin = 0 THEN ProcessLoop '过程循环处理
LOOP
SUB C.ButtonClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 1:
KB$ = "OC"
MsgBox KB$, "备份", "此操作将会覆盖您以前的备份文件!`您确定要备份系统吗?"
IF KB$ = "O" THEN
SHELL "GHOST.EXE -clone,mode=pdump,src=1:1,DST=c:\backup.gho -Z5 -sure -FX"
KB$ = "OC"
MsgBox KB$, "确定", "C盘已经备份成功,按确定退出!"
IF KB$ = "O" THEN RUN "RESTART.COM"
END IF
CASE 2:
KB$ = "OC"
MsgBox KB$, "恢复", "此操作将会覆盖您C盘的所有数据!`您确定要恢复系统吗?"
IF KB$ = "O" THEN
SHELL "ghost.exe -clone,mode=pload,src=c:\backup.gho:1,DST=1:1 -sure -FX"
KB$ = "OC"
MsgBox KB$, "确定", "C盘已经恢复成功,按确定退出!"
IF KB$ = "O" THEN RUN "RESTART.COM"
END IF
CASE 3:
KB$ = "YN"
MsgBox KB$, "警告", "是否退出系统并重新启动计算机?"
IF KB$ = "Y" THEN
SHELL "RESTART.COM"'
END IF
END SELECT
END SUB
SUB C.ButtonState (NWin, Inx, State)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.CheckClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.ComboClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.FormUnload (NWin, QBCancel)
SELECT CASE NWin
CASE 0:
'K$ = "OC": MsgBox K$, "退出", " 确定想离开吗?"
'QBCancel = (K$ = "C")
END SELECT
END SUB
SUB C.FrameClick (NWin, Inx, Button)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.FrameDblClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.FrameMouseInOut (NWin, Inx, State)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.FrameMouseState (NWin, Inx, X, Y, Button)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.ListChange (NWin, Inx, CType)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 1:
END SELECT
END SUB
SUB C.ListClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.ListDblClick (NWin, Inx)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.ListKeyPress (NWin, Inx, KeyCode)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.MenuClick (NWin, MInx, Inx)
DIM Sel AS LONG
Sel = NWin
Sel = Sel * 10000 + MInx * 100 + Inx
SELECT CASE Sel
CASE 1:
END SELECT
END SUB
SUB C.OptionClick (NWin, GInx, Inx)
Sel = NWin * 100 + GInx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.TextKeyPress (NWin, Inx, KeyCode)
Sel = NWin * 100 + Inx
SELECT CASE Sel
CASE 0:
END SELECT
END SUB
SUB C.Timer (NWin, KeyCode)
SELECT CASE NWin
CASE 0:
END SELECT
'LOCATE 1, 1: PRINT Mouse.X - Win.X; Mouse.Y - Win.Y
'LOCATE 1, 1: PRINT FRE(-1)
END SUB
SUB DisplayMenu (MenuNo, X, Y)
SHARED XMenu, ContObj
XMenu = MenuNo: ContObj = -1
IF X >= 0 THEN Mouse.X = X: Mouse.Y = Y
END SUB
SUB ListAdd (Inx, InsNo, Item$)
XListAdd Inx, InsNo, Item$, ListB(), ListI(), MaxListItem, ListItemBuffer
END SUB
FUNCTION ListGet$ (Inx, ListNo)
ListGet$ = XGetListItem$(Inx, ListNo, ListB(), ListI())
END FUNCTION
SUB ListRemove (Inx, RemNo)
XListRemove Inx, RemNo, ListB(), ListI(), MaxListItem
END SUB
SUB ListSet (Inx, ListNo, Item$)
XSetListItem Inx, ListNo, Item$, ListB(), ListI()
END SUB
SUB LoadWindow (XX, YY, W, H, Font, BC, Box, TC, T$)
ON ERROR RESUME NEXT
FOR A = 0 TO SumList
CLOSE ListB(A).FileNo
NEXT
ERASE Button, OptB, SumOptI, Check, Frame, ListB, ListI, TextTXT, Text
ERASE ButtonCap, OptBCap, OptBRValue, OptBValue, CheckCap, Combo, ComboTXT
ERASE Label, LabelCap, LabelRCap
ERASE Menu, MenuCap, SumMenu, PercentBar
SumPercent = -1
SumButton = -1
SumCheck = -1
SumOptG = -1
SumFrame = -1
SumList = -1
SumText = -1
SumCombo = -1
SumLabel = -1
SumMMenu = -1
DrawWindow XX, YY, W, H, Font, BC, Box, TC, T$, Button(), ButtonCap(), Win, SumButton
RW = ASC(MID$(Win.RetWins, 1, 1))
RW = RW + 1
MID$(Win.RetWins, 1, 1) = CHR$(RW)
MID$(Win.RetWins, RW + 1, 1) = CHR$(Wins)
ExitWin = 0
END SUB
SUB LoadButton (Cmd)
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumButton = SumButton + 1
B = SumButton
Button(B).X = VAL(T$)
READ Button(B).Y, Button(B).W, Button(B).H, Button(B).Enabled
READ Button(B).FC, Button(B).FW, Button(B).FH, Button(B).Hotkey, ButtonCap(B)
IF Cmd THEN Get3DCmd Win.X + Button(B).X - 2, Win.Y + Button(B).Y - 2, Button(B).W + 4, Button(B).H + 4, -1, Cmd, Win
LOOP
END SUB
SUB LoadCheck
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumCheck = SumCheck + 1
B = SumCheck
Check(B).X = VAL(T$)
READ Check(B).Y, Check(B).Enabled
READ Check(B).Value, Check(B).Hotkey, CheckCap(B)
LOOP
END SUB
SUB LoadCombo
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumCombo = SumCombo + 1
B = SumCombo
Combo(B).X = VAL(T$)
L = B + SumList + 1
READ Combo(B).Y, Combo(B).BW, Combo(B).Col, Combo(B).Enabled, HK, Combo(B).G3D
ListB(L).Hotkey = HK
ListB(L).Count = -1: ListB(L).Index = -1
LOOP
END SUB
SUB LoadFrame (Memo)
DO
READ T$: IF T$ = "=" THEN EXIT DO
X = VAL(T$)
READ Y, W, H, FC, FM, BC, Mode, C$
IF Memo THEN
SumFrame = SumFrame + 1
B = SumFrame
Frame(B).X = X: Frame(B).Y = Y
Frame(B).W = W: Frame(B).H = H
END IF
PrintFrame X, Y, W, H, FC, FM, BC, Mode, C$, Win
LOOP
END SUB
SUB LoadLabel (Memo, Cmd)
DO
READ T$: IF T$ = "=" THEN EXIT DO
X = VAL(T$)
READ Y, BW, FW, FH, FC, BC, FM, ST, MSG$
Get3DCmd Win.X + X - 3, Win.Y + Y - 3, BW * 6 + 6 + (FW - 12) * BW, FH + 5, BC, Cmd, Win
IF Memo > 0 THEN
SumLabel = SumLabel + 1
B = SumLabel
Label(B).X = X: Label(B).Y = Y
Label(B).FW = FW: Label(B).FH = FH
Label(B).BW = BW: Label(B).FC = FC
Label(B).BC = BC: Label(B).FM = FM
Label(B).Style = ST: LabelCap(B) = MSG$
ELSE
S = 1: MN = -1
DO
E = INSTR(S, MSG$, "`")
EE = E
IF E = 0 THEN EE = LEN(MSG$) + 1
MN = MN + 1
PrintFont X, Y + MN * FH, FW, FH, FC, BC, FM, MID$(MSG$, S, EE - S), Win
S = E + 1
LOOP WHILE E > 0
END IF
LOOP
END SUB
SUB LoadList
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumList = SumList + 1
B = SumList
ListB(B).X = VAL(T$)
READ ListB(B).Y, ListB(B).BW, ListB(B).Col, ListB(B).BH, ListB(B).Hotkey, ListB(B).G3D
ListB(B).Count = -1: ListB(B).Index = -1
LOOP
END SUB
SUB LoadMenu
DO
READ T$
IF T$ = "=" THEN EXIT DO
IF T$ = "-" THEN
SumMMenu = SumMMenu + 1: B = SumMMenu: A = 0
READ MenuHotkey(B), Menu(B, A).Enabled
ELSE
Menu(B, A).Enabled = VAL(T$)
END IF
READ Menu(B, A).Value, MenuCap(B, A)
SumMenu(B) = A: A = A + 1
LOOP
END SUB
SUB LoadOption
DO
READ T$
IF T$ = "=" THEN EXIT DO
IF T$ = "-" THEN
SumOptG = SumOptG + 1: B = SumOptG: A = 0
READ OptBValue(B), OptB(B, A).X
ELSE
OptB(B, A).X = VAL(T$)
END IF
READ OptB(B, A).Y, OptB(B, A).Enabled
READ OptB(B, A).Hotkey, OptBCap(B, A)
SumOptI(B) = A: A = A + 1
LOOP
END SUB
SUB LoadPercentbar
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumPercent = SumPercent + 1
B = SumPercent
PercentBar(B).X = VAL(T$)
READ PercentBar(B).Y, PercentBar(B).W, PercentBar(B).H
READ PercentBar(B).FC, PercentBar(B).BC, PercentBar(B).Style
ShowPercentbar B, 0, PercentBar(), Win
LOOP
END SUB
SUB LoadText
DO
READ T$: IF T$ = "=" THEN EXIT DO
SumText = SumText + 1
B = SumText
Text(B).X = VAL(T$)
READ Text(B).Y, Text(B).BW, Text(B).Enabled, Text(B).FC
READ Text(B).Password, Text(B).MaxLen, Text(B).Hotkey, Text(B).G3D
LOOP
END SUB
SUB MsgBox (KeyB$, Titl$, MSG$)
ON ERROR RESUME NEXT
SHARED MsgKey, ContObj
RW = Wins
MS$ = LEFT$(KeyB$, 1)
IF MS$ = "@" OR MS$ = "*" THEN
TWW = 39: H = 110
Wins = -2
SumText = SumText + 1
TextTXT(SumText) = MSG$: Text(SumText).Hotkey = 9
Text(SumText).Enabled = -1: Text(SumText).FC = 0
Text(SumText).MaxLen = VAL(MID$(KeyB$, 2)): Text(SumText).G3D = -1
Text(SumText).Locate = LEN(MSG$): Text(SumText).PassWord = MS$ = "*"
KeyB$ = "OC"
MSG$ = Titl$
Titl$ = ""
ELSE
IF Titl$ = "" THEN Titl$ = "信息"
Wins = -1
H = 90
END IF
S = 1: MN = -1
MS$ = ""
DO
E = INSTR(S, MSG$, "`")
EE = E
IF E = 0 THEN EE = LEN(MSG$) + 1': IF EE - S = 0 THEN MN = -2
IF MN < 0 AND Wins = -2 AND Titl$ = "" THEN
Titl$ = MID$(MSG$, S, EE - S)
IF Titl$ = "" THEN Titl$ = "输入"
ELSE
MN = MN + 1
MS$ = MS$ + MKI$(S) + MKI$(EE - S)
END IF
IF EE - S > TWW THEN TWW = EE - S
S = E + 1
LOOP WHILE E > 0
TW = TWW * 6 + 30
KK = LEN(KeyB$)
H = H + 14 * MN: W = 90 + (KK - 1) * 70: IF TW > W THEN W = TW
RRXX = Win.X: RRYY = Win.Y: RRWW = Win.W: RRHH = Win.H: RRBC = Win.BC
X = -1: Y = -1
RSButton = SumButton + 1
MouseHide
GetTX X, Y, W, H, 0
DrawWindow X, Y, W, H, 10, 7, 0, 1, CHR$(1) + Titl$, Button(), ButtonCap(), Win, SumButton
K = SumButton
FOR KA = 0 TO KK - 1
K$ = MID$(KeyB$, KA + 1, 1)
SELECT CASE UCASE$(K$)
CASE "O": C$ = "确定": HK = 13
CASE "Y": C$ = "是(Y)": HK = 277
CASE "N": C$ = "否(N)": HK = 305
CASE "A": C$ = "中断(A)": HK = 286
CASE "R": C$ = "重试(R)": HK = 275
CASE "I": C$ = "忽略(I)": HK = 279
CASE ELSE: C$ = "取消": HK = 27
END SELECT
K = K + 1: ButtonCap(K) = C$: Button(K).Hotkey = HK
Button(K).X = (W - KK * 68) \ 2 + 68 * KA
Button(K).Y = H - 52
Button(K).W = 60: Button(K).H = 17
Button(K).Enabled = 1: Button(K).FC = 0
Button(K).FW = 0: Button(K).FH = 12
NEXT
SumButton = K
FOR A = 0 TO MN
S = CVI(MID$(MS$, A * 4 + 1, 2))
E = CVI(MID$(MS$, A * 4 + 3, 2))
PrintChr Win.X + 10, Win.Y + 10 + 14 * A, 12, 12, 0, -1, MID$(MSG$, S, E)
NEXT
IF Wins = -2 THEN
Text(SumText).BW = TWW - 1
Text(SumText).X = 8
Text(SumText).Y = H - 83
MSG$ = TextTXT(SumText)
END IF
ExitWin = 0
MsgKey = RSButton
ProcessLoop
PutTX X, Y, 0
SumButton = RSButton - 1
Win.X = RRXX: Win.Y = RRYY: Win.W = RRWW: Win.H = RRHH: Win.BC = RRBC
KeyB$ = MID$(KeyB$, MsgKey, 1)
IF Wins = -2 THEN
SumText = SumText - 1: IF SumText > -1 THEN PrintText 0, 5, 0, Text(), TextTXT(), Win, CutBoard, 0
IF MsgKey = 1 THEN MSG$ = TextTXT(SumText + 1)
END IF
MouseShow
MsgKey = 0: ContObj = 0
Wins = RW: ExitWin = 0
END SUB
SUB ProcessLoop
DIM PicTime AS SINGLE, InitTime AS SINGLE, RTimeClick AS SINGLE
SHARED XMenu, ContObj, MsgKey, RXInpT, KeyCode
RecWins = Wins
IF SumText > -1 AND RecWins <> -1 THEN ContObj = 3 ELSE ContObj = 0
LST = 0: LEND = SumList: XLLCMD = -1: InitControl = -1
IF RecWins = -2 THEN
XInpText = SumText
ELSE
XInpText = 0
END IF
RXInpT = XInpText
MouseShow
DO
IF ContObj <> -1 THEN GetMouse Mouse
KeyCode = 0
IF NOT InitControl THEN
GetKey KeyCode
C.Timer RecWins, KeyCode
END IF
RTextI = 0
IF ContObj <> 4 AND ContObj < 10 THEN
XRKCL = XKCL
XRLCMD = XXLCMD: A = 0
FOR XLCMD = MsgKey TO SumButton
IF Button(XLCMD).Enabled <> Button(XLCMD).REnabled OR InitControl AND XLCMD > RSButton THEN PrintButton XLCMD, InitControl - 2, Button(), ButtonCap(), Win: C.ButtonState RecWins, (XLCMD), 1
GotFocus xicmd, (Button(XLCMD).X), (Button(XLCMD).Y), (Button(XLCMD).W), (Button(XLCMD).H), Mouse, Win
HK = KeyCode = Button(XLCMD).Hotkey
IF (xicmd OR HK) AND Button(XLCMD).Enabled THEN
IF Mouse.K = 1 AND Mouse.RK = 0 OR Mouse.K = 1 AND XLLCMD = XLCMD OR HK THEN
IF A <> 2 THEN XLLCMD = XLCMD: IF HK THEN A = 2 ELSE XKCL = 2
ContObj = 7
ELSE
XKCL = -1
IF Mouse.K = 0 AND Mouse.RK = 1 THEN XKCL = 1
END IF
XXLCMD = XLCMD
IF A = 0 THEN A = 1
END IF
NEXT
IF XRLCMD <> XXLCMD OR A = 0 THEN
XKCL = 0
IF XRKCL = 2 THEN XKCL = 1
IF Mouse.K = 0 AND Mouse.RK = 1 THEN XLLCMD = -1
END IF
IF XKCL <> XRKCL THEN
PrintButton XRLCMD, XKCL, Button(), ButtonCap(), Win
C.ButtonState RecWins, (XRLCMD), (XKCL)
END IF
IF Mouse.K = 0 AND XLLCMD = XXLCMD AND Mouse.RK = 1 OR A = 2 THEN
IF RecWins < 0 THEN
Mouse.K = -99: RXInpT = 0: MsgKey = XLLCMD - MsgKey: ExitWin = 2
ELSE
C.ButtonClick RecWins, (XLLCMD)
IF MsgKey = XLLCMD THEN ExitWin = 2
END IF
END IF
'IF Mouse.K = 1 AND Mouse.RK = 0 THEN
' GotFocus I, -5, -30, (Win.W), (Win.H), Mouse, Win
' IF I = 0 THEN BEEP
'END IF
IF RecWins <> -1 THEN
IF RecWins = -2 THEN
RSText = SumText
IF RContObj = 3 AND ContObj <> 3 THEN PrintText XInpText, 3, 0, Text(), TextTXT(), Win, CutBoard, XPutII
RContObj = ContObj
ELSE
RSText = 0
END IF
FOR L = RSText TO SumText
IF InitControl THEN
PrintText L, 5, 0, Text(), TextTXT(), Win, CutBoard, 0
IF L = SumText THEN PrintText XInpText, 5, 0, Text(), TextTXT(), Win, CutBoard, 0
ELSE
X = Text(L).X: Y = Text(L).Y: W = (Text(L).BW) * 6 + 8
GotFocus I, X, Y + 1, W, 17, Mouse, Win
IF I THEN RTextI = 1
A = (KeyCode = Text(L).Hotkey)
IF I AND Mouse.K <> 0 AND Mouse.RK = 0 OR A THEN
PrintText RXInpT, 3, 0, Text(), TextTXT(), Win, CutBoard, 1
IF A = 0 THEN Text(L).Locate = (Mouse.X - (Win.X + X) + 1) \ 6
XInpText = L: ContObj = 3
PrintText L, 4, 0, Text(), TextTXT(), Win, CutBoard, 0: RXInpT = XInpText
END IF
IF Text(L).Enabled <> Text(L).REnabled THEN
PrintText RXInpT, 3, 0, Text(), TextTXT(), Win, CutBoard, 1
PrintText L, 5, 0, Text(), TextTXT(), Win, CutBoard, 0
RXInpT = L
END IF
END IF
NEXT
IF ContObj = 3 THEN
IF KeyCode <> 0 THEN
'IF KeyCode = 328 THEN XInpText = XInpText - 1: IF XInpText < RSText THEN XInpText = SumText
'IF KeyCode = 336 OR
IF KeyCode = 9 THEN XInpText = XInpText + 1: IF XInpText > SumText THEN XInpText = RSText
ELSE
IF TIMER - PicTime > .4 THEN XPutII = 0
IF TIMER - PicTime > .9 THEN XPutII = 1: PicTime = TIMER
END IF
IF RXInpT <> XInpText THEN
PrintText RXInpT, 3, 0, Text(), TextTXT(), Win, CutBoard, 1
PrintText XInpText, 4, 0, Text(), TextTXT(), Win, CutBoard, 0
RXInpT = XInpText
ELSE
IF XPutII <> RXPutII OR KeyCode > 0 THEN
RXPutII = XPutII
PrintText XInpText, 2, KeyCode, Text(), TextTXT(), Win, CutBoard, XPutII
IF KeyCode <> 0 THEN C.TextKeyPress RecWins, XInpText, KeyCode
END IF
END IF
END IF
END IF
END IF
IF RRTextI <> RTextI THEN RRTextI = RTextI: SetMouseCursor RTextI
IF RecWins > -1 THEN
IF ContObj <> 4 THEN
II = 0
IF ContObj = 11 THEN
'IF Menu(XMenu, 0).Enabled THEN
XMenuHI = Menu(XMenu, 0).Enabled
IF XMenuHI > SumMenu(XMenu) THEN XMenuHI = SumMenu(XMenu)
MW = (SumMenu(XMenu) - 1) \ XMenuHI + 1
GotFocus II, RKMenuX + 2, RKMenuY - 3, MenuWidth * MW - 4, XMenuHI * 14 + 4, Mouse, Win
IF II AND (Mouse.Y <> XRMouseY OR Mouse.X <> XRMouseX) AND Mouse.Y > Win.Y + RKMenuY THEN
XMINX = ((Mouse.X - Win.X - RKMenuX - 1) \ MenuWidth) * XMenuHI + (Mouse.Y - Win.Y - RKMenuY - 1) \ 14 + 1
IF XMINX > SumMenu(XMenu) THEN XMINX = XRMINX
XRMouseY = Mouse.Y: XRMouseX = Mouse.X
END IF
IF II = 0 THEN IF Mouse.K = 1 THEN XMINX = 0
FOR A = 0 TO SumMenu(XMenu)
IF KeyCode = 336 THEN XMINX = XMINX + 1: IF XMINX > SumMenu(XMenu) THEN XMINX = 1
IF KeyCode = 328 THEN XMINX = XMINX - 1: IF XMINX < 1 THEN XMINX = SumMenu(XMenu)
IF MenuCap(XMenu, XMINX) <> "" THEN EXIT FOR
NEXT
IF KeyCode < 256 THEN
FOR A = 1 TO SumMenu(XMenu)
Cap$ = MenuCap(XMenu, A): L = INSTR(Cap$, "(")
Cap$ = UCASE$(MID$(Cap$, L + 1, 1))
IF Cap$ = UCASE$(CHR$(KeyCode)) THEN Mouse.K = 0: Mouse.RK = 1: XMINX = A: II = -1: EXIT FOR
NEXT
END IF
IF KeyCode = 13 THEN Mouse.K = 0: Mouse.RK = 1: II = -1
IF XMINX <> XRMINX THEN PrintMenu XMenu, XRMINX, XMINX, 4, Menu(), MenuCap(), SumMenu(), Win, RKSMenuX, RKSMenuY, RKMenuX, RKMenuY, MenuWidth: XRMINX = XMINX
IF Mouse.K = 0 AND Mouse.RK = 1 AND Menu(XMenu, XMINX).Enabled AND MenuCap(XMenu, XMINX) <> "" THEN IF XMINX > 0 THEN XPUT = 2 ELSE XPUT = 1
'END IF
IF (Mouse.K = 0 AND Mouse.RK > 0 OR RKSMenuX = -1 AND Mouse.K = 2 AND Mouse.RK = 0) AND II = 0 THEN XPUT = 1
PR = 0
IF KeyCode = 27 THEN XPUT = 1
IF RKSMenuX <> -1 THEN
IF KeyCode = 333 THEN XMenu = XMenu + 1: PR = -1: IF XMenu > SumMMenu THEN XMenu = 0
IF KeyCode = 331 THEN XMenu = XMenu - 1: PR = -1: IF XMenu < 0 THEN XMenu = SumMMenu
END IF
IF PR THEN XPUT = 2: XMINX = 0: ContObj = 10: XRMouseX = Mouse.X: XRMouseY = Mouse.Y
END IF
RKSMX = 0: RKSMY = -1
FOR M = 0 TO SumMMenu
IF M > 0 THEN
RKSMX = RKSMX + (LEN(MenuCap(M - 1, 0)) + 2) * 6 + 2
IF RKSMX + (LEN(MenuCap(M, 0)) + 2) * 6 + 2 > Win.W - 7 THEN RKSMX = 0: RKSMY = RKSMY + 14
END IF
GotFocus I, RKSMX - 1, RKSMY - 1, 6 * (LEN(MenuCap(M, 0)) + 2) + 2, 14, Mouse, Win
IF I AND II = 0 OR KeyCode = MenuHotkey(M) THEN
IF Mouse.K = 1 AND Mouse.RK = 0 OR KeyCode = MenuHotkey(M) OR XMenu <> M AND ContObj = 11 AND (Mouse.X <> XRMouseX OR Mouse.Y <> XRMouseY) THEN
IF ContObj = 11 THEN XPUT = 1
ContObj = 10: XMenu = M: XRMouseX = Mouse.X: XRMouseY = Mouse.Y
END IF
END IF
IF InitControl THEN
PrintMenu M, -1, -1, 0, Menu(), MenuCap(), SumMenu(), Win, RKSMX, RKSMY, RKMenuX, RKMenuY, MenuWidth
IF M = SumMMenu THEN MouseHide: Get3DBox (Win.X), (Win.Y) + RKSMY + 14, (Win.W) - 8, 1, 8, 15, -1: MouseShow
END IF
IF M = XMenu AND ContObj = 10 THEN RKSMenuX = RKSMX: RKSMenuY = RKSMY: RKMenuX = RKSMenuX - 1: RKMenuY = RKSMenuY + 16
NEXT
IF XPUT THEN
PrintMenu XRMenu, -1, -1, 3, Menu(), MenuCap(), SumMenu(), Win, RRKSMX, RRKSMY, RRKMX, RRKMY, RMW
IF XRMenu = XMenu THEN ContObj = 0
XRMenu = XMenu
IF XPUT = 2 THEN
C.MenuClick RecWins, XMenu, XMINX
ELSE
C.MenuClick -RecWins, -XMenu, 0
END IF
XPUT = 0: Mouse.K = -100: Mouse.RK = -100
RRTextI = 0: KeyCode = 0
END IF
IF ContObj = -1 THEN
SetMouseCursor 0: ContObj = 10
RKMenuY = Mouse.Y - Win.Y + 3
RKMenuX = Mouse.X - Win.X
RKSMenuX = -1
END IF
END IF
IF RContObj = 3 AND ContObj <> 3 THEN PrintText XInpText, 3, 0, Text(), TextTXT(), Win, CutBoard, XPutII
IF RContObj = 5 AND ContObj <> 5 THEN PrintCombo XCombo, 3, 0, Combo(), ComboTXT(), Win
RContObj = ContObj
IF ContObj = 10 THEN
C.MenuClick RecWins, XMenu, 0
PrintMenu XMenu, -1, 0, 1, Menu(), MenuCap(), SumMenu(), Win, RKSMenuX, RKSMenuY, RKMenuX, RKMenuY, MenuWidth
XRMenu = XMenu: XRMINX = 0: XMINX = 0
ContObj = 12
RRKSMX = RKSMenuX: RRKSMY = RKSMenuY
RRKMX = RKMenuX: RRKMY = RKMenuY: RMW = MenuWidth
END IF
IF ContObj = 12 AND Mouse.K = 0 AND Mouse.RK = 0 THEN ContObj = 11
IF ContObj < 10 THEN
IF (ContObj = 2 OR ContObj = 4) AND KeyCode > 0 THEN
I = ListB(XList).Index: S = ListB(XList).ScInx
B = S + ListB(XList).BH * ListB(XList).Col
IF KeyCode = 331 AND I > ListB(XList).BH - 1 THEN I = I - ListB(XList).BH: IF I < S THEN S = S - ListB(XList).BH
IF KeyCode = 333 AND I < ListB(XList).Count - ListB(XList).BH + 1 THEN I = I + ListB(XList).BH: IF I > B - 1 THEN S = S + ListB(XList).BH
IF KeyCode = 328 AND I > 0 THEN I = I - 1: IF I < S OR ListB(XList).BW <= 0 THEN IF ListB(XList).Col > 1 THEN S = S - ListB(XList).BH ELSE S = S - 1: I = S
IF KeyCode = 336 AND I < ListB(XList).Count THEN
I = I + 1
IF I > B - 1 OR ListB(XList).BW <= 0 THEN IF ListB(XList).Col > 1 THEN S = S + ListB(XList).BH ELSE S = S + 1: I = B
END IF
IF ContObj = 4 THEN
IF KeyCode = 13 THEN XComExit = 2: KeyCode = 0
IF KeyCode = 27 THEN XComExit = 1: KeyCode = 0
END IF
ListB(XList).Index = I: ListB(XList).ScInx = S
IF I > -1 THEN C.ListKeyPress RecWins, XList, KeyCode
END IF
RXL = XXL: XXX = 0
FOR XL = LST TO LEND
IF InitControl OR ContObj = -9 THEN
PrintList XL, -1, 1, 0, -2, ListB(), ListI(), Win: IF ContObj = -9 THEN ContObj = 4
ELSE
X = ListB(XL).X + 2: Y = ListB(XL).Y + 2: W = (ListB(XL).BW * ListB(XL).Col) * 6 + ListB(XL).Col * 3: H = ListB(XL).BH * 14 + 1
GotFocus XILIT, X, Y, W + 18, H, Mouse, Win
IF RXL <> XL AND PK AND XILIT THEN ListB(XXL).RCount = -2
IF (XILIT OR KeyCode = ListB(XL).Hotkey) AND ListB(XL).Count >= 0 AND XXX = 0 THEN
IF (Mouse.K = 1 AND Mouse.RK = 0 OR KeyCode = ListB(XL).Hotkey) AND ContObj <> 4 THEN ContObj = 2: XList = XL
GotFocus XLIL, X + W, Y, 18, H, Mouse, Win
MY = Mouse.Y - (Win.Y + Y)
MX = Mouse.X - (Win.X + X)
IF XLIL THEN
XSYY = -1
XMS = ListB(XL).Count - ListB(XL).BH * ListB(XL).Col + 1
IF XMS > 0 THEN
IF Mouse.K <> 1 AND Mouse.RK <> Mouse.K THEN PK = 0: MCNT = 0: NK = RNK: PR = 1: EXIT FOR
IF Mouse.K = 1 AND Mouse.RK = 0 THEN
NK = 5: PK = 1
IF MY < 16 THEN NK = 2 ELSE IF MY > H - 14 THEN NK = 3
PR = 1: RTimeClick = TIMER: InitTime = .4
RNK = NK
END IF
END IF
ELSE
IF RNK <> 0 AND Mouse.K <> 1 THEN RXL = XL: PK = 0: MCNT = 0: NK = 4: PR = 1: XSYY = -1: RNK = 0
IF Mouse.K <> 0 AND Mouse.RK = 0 OR ContObj = 4 AND (XRMouseY <> Mouse.Y OR XRMouseX <> Mouse.X) THEN
IL = (MY - 1) \ 14: JL = (MX - 1) \ (ListB(XL).BW * 6 + 3)
IL = ListB(XL).ScInx + JL * ListB(XL).BH + IL
IF IL > ListB(XL).Count THEN IL = -1
ListB(XL).Index = IL: XRMouseY = Mouse.Y: XRMouseX = Mouse.X
END IF
IF Mouse.K = 1 AND Mouse.RK = 0 THEN
IF ContObj = 4 THEN
XComExit = 2
ELSE
IF Mouse.DC AND IL > -1 AND ListB(XL).Index = ListB(XL).rIndex THEN C.ListDblClick RecWins, XL
END IF
END IF
END IF
MCNT = 0
IF Mouse.K = 1 AND (TIMER - RTimeClick > InitTime AND (RNK = 2 OR RNK = 3) OR RNK = 5) THEN MCNT = 1: RTimeClick = TIMER: InitTime = ListScrollSpeed / 10
IF Mouse.K = 1 AND Mouse.RK = 0 OR MCNT THEN
S = ListB(XL).ScInx
IF RNK = 2 AND S > 0 THEN S = S - 1
IF RNK = 5 THEN
XSYY = MY - 15
IF XSYY < 0 THEN XSYY = 0
IF XSYY <> XRY THEN PR = 1: XRY = XSYY
END IF
IF RNK = 3 AND S < XMS + -(ListB(XL).Col > 1) * (ListB(XL).BH - ListB(XL).Count MOD ListB(XL).BH - 1) THEN S = S + 1
ListB(XL).ScInx = S
END IF
XXL = XL: XXX = 1
ELSE
IF RNK <> 0 THEN PK = 1
END IF
XPR = -1: XI = -1
B = ListB(XL).Index <> ListB(XL).rIndex
IF ListB(XL).Count <> ListB(XL).RCount THEN
XPR = 4
ELSEIF ListB(XL).ScInx <> ListB(XL).RScInx THEN
XPR = 5
ELSEIF B THEN
XI = ListB(XL).rIndex
XPR = 0
END IF
IF XPR > -1 THEN
RrInx = ListB(XL).rIndex
PrintList XL, XI, XPR, 0, -1, ListB(), ListI(), Win
ListB(XL).rIndex = RrInx
C.ListChange RecWins, XL, XPR
ListB(XL).rIndex = ListB(XL).Index
END IF
IF B AND ListB(XL).Index > -1 THEN C.ListClick RecWins, XL
END IF
NEXT
IF XXX = 0 AND PK THEN PR = 1: PK = 0: NK = RNK: XRY = -1: MCNT = 0: RNK = 0
IF PR AND RXL <= LEND THEN
RScInx = ListB(RXL).ScInx
PrintList RXL, -2, NK, PK, XSYY, ListB(), ListI(), Win: PR = 0
IF RScInx <> ListB(RXL).ScInx THEN C.ListChange RecWins, RXL, 9
END IF
IF XXX = 0 AND ContObj = 4 AND Mouse.K = 1 AND Mouse.RK = 0 THEN XComExit = 1
IF XComExit AND Mouse.K = 0 THEN
IF XComExit = 1 OR ListB(LEND).Index < 0 THEN ListB(LEND).Index = XComIndex: XComExit = 0
IF XComExit = 2 THEN SetCombo XCombo, (ListB(LEND).Index)
ContObj = 5: Mouse.RK = 0
MouseHide
PutTX Win.X + Combo(XCombo).X, XCOMY, 0
MouseShow
PrintCombo XCombo, 4, 0, Combo(), ComboTXT(), Win
IF XComExit = 2 THEN C.ComboClick RecWins, XCombo
XComExit = 0
LST = 0: LEND = SumList
END IF
IF ContObj <> 4 THEN
FOR T = 0 TO SumLabel
IF LabelCap(T) <> LabelRCap(T) OR InitControl THEN PrintLabel T, Label(), LabelCap(), LabelRCap(), Win
NEXT
FOR T = 0 TO SumOptG
FOR L = 0 TO SumOptI(T)
IF OptB(T, L).Enabled <> OptB(T, L).REnabled OR InitControl THEN PrintOption T, L, 11, OptB(), OptBRValue(), OptBValue(), OptBCap(), Win, SumOptI()
GotFocus I, (OptB(T, L).X), (OptB(T, L).Y), LEN(OptBCap(T, L)) * 6 + 16, 12, Mouse, Win
IF (I AND Mouse.K = 1 AND Mouse.RK = 0 OR KeyCode = OptB(T, L).Hotkey) AND OptB(T, L).Enabled THEN
OptBValue(T) = L
ContObj = 1
END IF
NEXT
IF OptBValue(T) <> OptBRValue(T) THEN
PrintOption T, -1, 0, OptB(), OptBRValue(), OptBValue(), OptBCap(), Win, SumOptI()
C.OptionClick RecWins, T, (OptBValue(T))
END IF
NEXT
FOR L = 0 TO SumCheck
IF Check(L).Enabled <> Check(L).REnabled OR InitControl THEN PrintCheck L, 11, Check(), CheckCap(), Win
GotFocus I, (Check(L).X), (Check(L).Y), LEN(CheckCap(L)) * 6 + 16, 12, Mouse, Win
IF (I AND Mouse.RK = 1 AND Mouse.K = 0 OR KeyCode = Check(L).Hotkey) AND Check(L).Enabled THEN
Check(L).Value = NOT Check(L).Value
ContObj = 6
END IF
IF Check(L).Value <> Check(L).RValue THEN
PrintCheck L, 0, Check(), CheckCap(), Win
C.CheckClick RecWins, L
END IF
NEXT
FOR A = 0 TO SumFrame
GotFocus I, (Frame(A).X), (Frame(A).Y), (Frame(A).W), (Frame(A).H), Mouse, Win
IF I THEN
IF Frame(A).GF = 0 THEN Frame(A).GF = -1: C.FrameMouseInOut RecWins, A, 1
IF Mouse.X <> Mouse.RX OR Mouse.Y <> Mouse.RY OR Mouse.K <> 0 OR Mouse.RK <> Mouse.K THEN C.FrameMouseState RecWins, A, (Mouse.X - Win.X - Frame(A).X), (Mouse.Y - Win.Y - Frame(A).Y), (Mouse.K)
IF Mouse.DC THEN
C.FrameDblClick RecWins, A
ELSEIF Mouse.K = 0 AND Mouse.RK <> 0 THEN
C.FrameClick RecWins, A, (Mouse.RK)
END IF
'EXIT FOR
ELSE
IF Frame(A).GF THEN Frame(A).GF = 0: C.FrameMouseInOut RecWins, A, 0
END IF
NEXT
FOR XLCOM = 0 TO SumCombo
IF Combo(XLCOM).Enabled <> Combo(XLCOM).REnabled OR InitControl THEN PrintCombo XLCOM, 1, 0, Combo(), ComboTXT(), Win
X = Combo(XLCOM).X: Y = Combo(XLCOM).Y: W = (Combo(XLCOM).BW) * 6
IF Combo(XLCOM).G3D > 0 THEN A = 1 ELSE A = 0
GotFocus I, X + A * (W + 7), Y + 1, (1 - A) * W + 23 - A * 5, 21, Mouse, Win
IF (I AND Mouse.K = 1 AND Mouse.RK = 0 OR KeyCode = ListB(SumList + XLCOM + 1).Hotkey) AND Combo(XLCOM).Enabled THEN
PrintCombo XCombo, 3, 0, Combo(), ComboTXT(), Win
MouseHide
GetTX Win.X + X, XCOMY, W + 25, H - 22, 0
MouseShow
PrintCombo XLCOM, 2, 1, Combo(), ComboTXT(), Win
ContObj = -9: XCombo = XLCOM
A = SumList + XLCOM + 1: XList = A
ListB(A).BH = ListB(A).Count + 1: IF ListB(A).BH > 8 THEN ListB(A).BH = 8
IF ListB(A).BH < 2 THEN ListB(A).BH = 1
LST = A: LEND = A: XComIndex = ListB(A).Index
H = ListB(A).BH * 14 + 2
B = Combo(XLCOM).G3D <> 0
XCOMY = Win.Y + Y + 18 - B
IF XCOMY + H > 455 THEN XCOMY = XCOMY - H - 20 + B * 2
ListB(A).BW = Combo(XCombo).BW
ListB(A).Col = (ListB(A).Count \ ListB(A).BH) + 1
IF ListB(A).Col > Combo(XLCOM).Col THEN ListB(A).Col = Combo(XLCOM).Col
B = ListB(A).BW * ListB(A).Col * 6 + 20 + (ListB(A).Col - 1) * 3
ListB(A).X = Combo(XCombo).X
IF ListB(A).X + B + Win.X + 3 > 640 THEN ListB(A).X = 640 - B - Win.X - 3
ListB(A).Y = XCOMY - Win.Y
IF RContObj = 3 THEN PrintText XInpText, 3, 0, Text(), TextTXT(), Win, CutBoard, 1
MouseHide
DrawBackBlock Win.X + ListB(A).X, Win.Y + ListB(A).Y, B, H, 5
MouseShow
C.ComboClick RecWins, -XCombo - 1
END IF
NEXT
END IF
END IF
END IF
InitControl = 0
IF ExitWin THEN
IF RecWins < 0 THEN EXIT DO
A = 0
C.FormUnload RecWins, A
IF A = 0 THEN
IF Wins = RecWins THEN
B = ASC(MID$(Win.RetWins, 1, 1))
IF B <= 1 THEN UnLoadMe
Wins = ASC(MID$(Win.RetWins, B, 1))
B = B - 2
IF B < 0 THEN B = 0
MID$(Win.RetWins, 1, 1) = CHR$(B)
END IF
EXIT DO
ELSE
ExitWin = 0: Wins = RecWins
END IF
END IF
LOOP
MouseHide
END SUB
SUB SetCombo (Inx, InxNo)
A = Inx + SumList + 1
ListB(A).Index = InxNo
IF InxNo < 0 THEN ComboTXT(Inx) = "" ELSE ComboTXT(Inx) = ListGet$(A, InxNo)
PrintCombo Inx, 2, 0, Combo(), ComboTXT(), Win
'Combo(Inx).REnabled = 2
END SUB
图片浏览:
[ 本帖最后由 网络游侠 于 2006-7-22 11:16 PM 编辑 ] |
|