|
发表于 2011-1-11 15:34:31
|
显示全部楼层
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=软件安装.ico
#AutoIt3Wrapper_outfile=软件安装.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=软件安装
#AutoIt3Wrapper_Res_Description=YFの锋 作品
#AutoIt3Wrapper_Res_Fileversion=0.6.1.5
#AutoIt3Wrapper_Res_LegalCopyright=-YF工作室- QQ:56080840
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Opt("PixelCoordMode", 0)
If FileExists(@ScriptDir & "\soft\SoftTool.ini") = 0 Then
MsgBox(64 + 0, "错误!", "请将配置文件放置于" & @ScriptDir & "\soft\SoftTool.ini 再运行!")
Exit
EndIf
Dim $q = 0
Dim $MAX = IniReadSection("soft\SoftTool.ini ", "soft")
For $i = 1 To $MAX[0][0] / 5
If FileExists(IniRead("soft\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Or FileExists(IniRead("soft\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
$q = $q + 1
If IniRead("soft\SoftTool.ini", "soft", "Name" & $i, "") = "" And IniRead("soft\SoftTool.ini", "soft", "Manual" & $i, "") <> "" Then
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Name" & $q, "这家伙很懒居然没有写软件名称")
ElseIf IniRead("soft\SoftTool.ini", "soft", "Name" & $i, "") = "" And IniRead("soft\SoftTool.ini", "soft", "auto" & $i, "") <> "" Then
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Name" & $q, "这家伙很懒居然没有写软件名称")
Else
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Name" & $q, IniRead("soft\SoftTool.ini", "soft", "Name" & $i, ""))
EndIf
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Auto" & $q, IniRead("soft\SoftTool.ini", "soft", "auto" & $i, ""))
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $q, IniRead("soft\SoftTool.ini", "soft", "Manual" & $i, ""))
If IniRead("soft\SoftTool.ini", "soft", "Info" & $i, "") = "" Then
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Info" & $q, "这家伙很懒居然没写任何关于该软件的信息")
Else
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "Info" & $q, IniRead("soft\SoftTool.ini", "soft", "info" & $i, ""))
EndIf
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $q, IniRead("soft\SoftTool.ini", "soft", "A" & $i, ""))
EndIf
Next
If $q >= 5 Then
Dim $OBJMAX = $q
Else
Dim $OBJMAX = 5
EndIf
Dim $CTTU[$OBJMAX + 1]
Dim $CKBX[$OBJMAX + 1]
Dim $NoAU[$OBJMAX + 1]
Dim $AUTO[$OBJMAX + 1]
Dim $ICOK[$OBJMAX + 1]
Dim $ICON[$OBJMAX + 1]
Dim $SFNM[$OBJMAX + 1]
Dim $SFME[$OBJMAX + 1]
Dim $SFSZ[$OBJMAX + 1]
Dim $xt[$OBJMAX + 2]
Dim $ISsetColor = 0
Dim $with = 60
Dim $p
Dim $Flag = False ;等待时间终止标志
;If IniRead("soft\SoftTool.ini", "SoftTool", "logo", "") <> "" Then
;FileCopy(IniRead("soft\SoftTool.ini", "SoftTool", "logo", ""), @WindowsDir & "\temp\back.jpg", 1)
;Else
FileInstall("soft\pic\back.jpg", @WindowsDir & "\temp\", 1)
;EndIf
read()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("SoftTool v2.1", 538, 400, -1, -1);建立主窗口
GUISetFont(9, 400)
$Pic1 = GUICtrlCreatePic(@WindowsDir & "\temp\back.jpg", 0, 0, 538, 100)
FileDelete(@WindowsDir & "\temp\back.jpg")
$Form2 = GUICreate("", 537, 238, 0, 100, $WS_CHILD, $WS_EX_CLIENTEDGE, $Form1);建立滑动条
For $i = 1 To $OBJMAX
$NoAU[$i] = GUICtrlCreateLabel("手动安装", 450, 21 + $with * ($i - 1), 48, 14);建立手动安装按钮
If FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
GUICtrlSetColor($NoAU[$i], 0xFF0000)
GUICtrlSetCursor($NoAU[$i], 0)
GUICtrlSetFont($NoAU[$i], 8, 400, 4, "MS Sans Serif")
GUICtrlSetBkColor($NoAU[$i], $GUI_BKCOLOR_TRANSPARENT)
Else
GUICtrlSetState($NoAU[$i], $GUI_DISABLE)
GUICtrlSetBkColor($NoAU[$i], $GUI_BKCOLOR_TRANSPARENT)
EndIf
Next
For $i = 1 To $OBJMAX
$AUTO[$i] = GUICtrlCreateLabel("自动安装", 450, 42 + $with * ($i - 1), 48, 14);建立自动安装按钮
If FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
GUICtrlSetColor($AUTO[$i], 0xFF0000)
GUICtrlSetCursor($AUTO[$i], 0)
GUICtrlSetFont($AUTO[$i], 8, 400, 4, "MS Sans Serif")
GUICtrlSetBkColor($AUTO[$i], $GUI_BKCOLOR_TRANSPARENT)
Else
GUICtrlSetState($AUTO[$i], $GUI_DISABLE)
GUICtrlSetBkColor($AUTO[$i], $GUI_BKCOLOR_TRANSPARENT)
EndIf
Next
For $i = 1 To $OBJMAX
$CKBX[$i] = GUICtrlCreateCheckbox("", 23, 31 + $with * ($i - 1), 13, 13);建立Checkbox
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 Then
GUICtrlSetState($CKBX[$i], $GUI_CHECKED)
EndIf
Next
For $i = 1 To $OBJMAX + 1
$xt[$i] = GUICtrlCreateGraphic(13, 8 + $with * ($i - 1), 495, 1, $SS_ETCHEDHORZ);建立分割线
Next
For $i = 1 To $OBJMAX
Dim $withX = 60 * ($i - 1)
If $i > 2 Then
$withX = $withX + 4
$CTTU[$i] = GUICtrlCreateGraphic(11, 12 + $withX, 498, 50);建立绿色选框
Else
$CTTU[$i] = GUICtrlCreateGraphic(11, 12 + $withX, 498, 50);建立绿色选框
EndIf
Next
For $i = 1 To $OBJMAX
Dim $withY = 60 * ($i - 1)
If $i > 2 Then
$withY = $withY + 2
$ICOK[$i] = GUICtrlCreateGraphic(43, 18 + $withY, 40, 40, BitOR($SS_WHITERECT, $WS_BORDER));建立图标框
Else
$ICOK[$i] = GUICtrlCreateGraphic(43, 18 + $withY, 40, 40, BitOR($SS_WHITERECT, $WS_BORDER));建立图标框
EndIf
Next
For $i = 1 To $OBJMAX
Dim $withZ = 60 * ($i - 1)
If $i > 2 Then
$withZ = $withZ + 2
$ICON[$i] = GUICtrlCreateIcon("", -1, 47, 22 + $withZ, 32, 32);建立图标
Else
$ICON[$i] = GUICtrlCreateIcon("", -1, 47, 22 + $withZ, 32, 32);建立图标
EndIf
If FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
GUICtrlSetImage($ICON[$i], IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, ""))
ElseIf FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
GUICtrlSetImage($ICON[$i], IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, ""))
EndIf
Next
For $i = 1 To $OBJMAX
$SFNM[$i] = GUICtrlCreateLabel("", 96, 21 + $with * ($i - 1), 204, 14);建立软件名称
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $i, "") <> "" Then
GUICtrlSetData($SFNM[$i], IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $i, "") & " ...")
Else
GUICtrlSetData($SFNM[$i], " ...")
EndIf
GUICtrlSetFont($SFNM[$i], 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor($SFNM[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
For $i = 1 To $OBJMAX
$SFSZ[$i] = GUICtrlCreateLabel(" 0.00 MB", 373, 21 + $with * ($i - 1), 60, 14);建立软件大小
If FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
Dim $noA = Round(FileGetSize(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) / 1000000, 2)
If StringLen($noA) = 4 Then
GUICtrlSetData($SFSZ[$i], " " & $noA & " MB")
ElseIf StringLen($noA) = 5 Then
GUICtrlSetData($SFSZ[$i], " " & $noA & " MB")
Else
GUICtrlSetData($SFSZ[$i], $noA & " MB")
EndIf
ElseIf FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) = 0 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
Dim $noA = Round(FileGetSize(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) / 1000000, 2)
If StringLen($noA) = 4 Then
GUICtrlSetData($SFSZ[$i], " " & $noA & " MB")
ElseIf StringLen($noA) = 5 Then
GUICtrlSetData($SFSZ[$i], " " & $noA & " MB")
Else
GUICtrlSetData($SFSZ[$i], $noA & " MB")
EndIf
ElseIf FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) = 0 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) = 0 Then
GUICtrlSetData($SFSZ[$i], " 0.00 MB")
EndIf
GUICtrlSetBkColor($SFSZ[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
For $i = 1 To $OBJMAX
$SFME[$i] = GUICtrlCreateLabel("", 96, 42 + $with * ($i - 1), 336, 14);建立软件说明
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "info" & $i, "") <> "" Then
GUICtrlSetData($SFME[$i], IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "info" & $i, "") & " ...")
Else
GUICtrlSetData($SFME[$i], " ...")
EndIf
GUICtrlSetBkColor($SFME[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
GUISetState()
GUISwitch($Form1)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
$Checkbox1 = GUICtrlCreateCheckbox(" 全选/不选", 23, 353, 80, 14)
$Button1 = GUICtrlCreateButton("手动安装", 368, 349, 70, 20)
$Button2 = GUICtrlCreateButton("自动安装", 448, 349, 70, 20)
GUICtrlSetState($Button2, $GUI_DEFBUTTON)
$Graphic1 = GUICtrlCreateGraphic(13, 376, 515, 2, $SS_ETCHEDHORZ)
$Label1 = GUICtrlCreateLabel("您有" & $q & "个软件可选择安装 ...", 23, 382, 326, 14)
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("喜欢的自己改", 403, 382, 114, 14)
GUICtrlSetColor(-1, 0xA0A0A4)
$progressbar1 = GUICtrlCreateProgress(23, 353, 300, 14)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState()
#EndRegion ### END Koda GUI section ###
_GUIScrollBars_Init($Form2, 0, 51)
Dim $Color = Hex(PixelGetColor(11, 383, $Form1), 6)
HotKeySet("{esc}", "_Flag")
If IniRead("soft\SoftTool.ini", "SoftTool", "autoinstall", "") = 1 Then
autoinstall()
EndIf
While 1
$nMsg = GUIGetMsg()
GetPos()
Switch $nMsg
Case $GUI_EVENT_CLOSE
FileDelete(@WindowsDir & "\temp\SoftTool.ini")
Exit
Case $Checkbox1
Beep(1000, 50)
all()
Case $NoAU[1] To $NoAU[$OBJMAX]
Beep(1000, 50)
GUICtrlSetData($Label1, "手动安装" & IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $ISsetColor, ""))
RunWait(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $ISsetColor, ""))
GUICtrlSetData($Label1, "安装完毕!")
Case $AUTO[1] To $AUTO[$OBJMAX]
Beep(1000, 50)
GUICtrlSetData($Label1, "自动安装" & IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $ISsetColor, ""))
RunWait(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $ISsetColor, ""))
GUICtrlSetData($Label1, "安装完毕!")
Case $CKBX[1] To $CKBX[$OBJMAX]
If GUICtrlRead($CKBX[$ISsetColor]) = $GUI_CHECKED Then
Beep(1000, 50)
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $ISsetColor, "1")
Else
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $ISsetColor, "")
EndIf
Case $Button1
Beep(1000, 50)
Manual()
Case $Button2
Beep(1000, 50)
auto()
EndSwitch
WEnd
Func read()
Dim $p = 0
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
$p = $p + 1
EndIf
Next
EndFunc ;==>read
Func GetPos()
Local $a
$a = GUIGetCursorInfo($Form1)
For $i = 1 To $OBJMAX
If $a[4] = $CTTU[$i] Or $a[4] = $CKBX[$i] Or $a[4] = $ICOK[$i] Or _
$a[4] = $ICON[$i] Or $a[4] = $SFNM[$i] Or $a[4] = $SFME[$i] Or $a[4] = $SFSZ[$i] Then
If $ISsetColor <> $i Then
GUICtrlSetBkColor($CTTU[$ISsetColor], "0x" & $Color)
GUICtrlSetBkColor($CTTU[$i], 0x9CD560)
$ISsetColor = $i
ExitLoop
EndIf
EndIf
Next
Return
EndFunc ;==>GetPos
Func all()
For $i = 1 To $OBJMAX
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
If FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Or FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "1")
GUICtrlSetState($CKBX[$i], $GUI_CHECKED)
Else
GUICtrlSetState($CKBX[$i], $GUI_UNCHECKED)
EndIf
Else
GUICtrlSetState($CKBX[$i], $GUI_UNCHECKED)
IniWrite(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "")
EndIf
Next
EndFunc ;==>all
Func auto()
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($progressbar1, $GUI_SHOW)
Dim $w = 0, $p = 0
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
$p = $p + 1
EndIf
Next
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
$w = $w + 1
Beep(1000, 50)
GUICtrlSetData($Label1, $w & "/" & $p & " 正在安装" & IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $i, "") & ",请稍后...")
RunWait(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, ""))
GUICtrlSetData($progressbar1, Int(100 / $p * $w))
EndIf
Next
Beep(1000, 100)
Sleep(200)
Beep(1000, 100)
GUICtrlSetData($Label1, "^_^ 所选软件全部安装完毕!")
GUICtrlSetState($progressbar1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_SHOW)
GUICtrlSetState($Button2, $GUI_ENABLE)
EndFunc ;==>auto
Func Manual()
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($progressbar1, $GUI_SHOW)
Dim $w = 0, $p = 0
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
$p = $p + 1
EndIf
Next
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "Manual" & $i, "")) <> 0 Then
$w = $w + 1
Beep(1000, 50)
GUICtrlSetData($Label1, $w & "/" & $p & " 正在安装" & IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $i, ""))
RunWait(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, ""))
GUICtrlSetData($progressbar1, Int(100 / $p * $w))
EndIf
Next
Beep(1000, 100)
Sleep(200)
Beep(1000, 100)
GUICtrlSetData($Label1, "^_^ 所选软件全部安装完毕!")
GUICtrlSetState($progressbar1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_SHOW)
GUICtrlSetState($Button1, $GUI_ENABLE)
EndFunc ;==>Manual
Func autoinstall()
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Checkbox1, $GUI_HIDE)
GUICtrlSetState($progressbar1, $GUI_SHOW)
Local $Time, $TimeCount, $PROV
$Time = IniRead("soft\SoftTool.ini", "softtool", "timeout", "")
If $Time = "" Then
AutoGO()
Else
$TimeCount = 0
GUICtrlSetData($Label1, "按下“ESC”键可以终止软件自动安装过程...")
While 1
Sleep(100)
$TimeCount = $TimeCount + 1
$PROV = Int($TimeCount / 10 / $Time * 100)
If $PROV > 100 Then ExitLoop
GUICtrlSetData($progressbar1, $PROV)
If $Flag = True Then
Beep(1000, 50)
GUICtrlSetData($Label1, "用户终止了软件自动安装过程...")
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($progressbar1, $GUI_HIDE)
GUICtrlSetState($Checkbox1, $GUI_SHOW)
ExitLoop
EndIf
WEnd
HotKeySet("{esc}")
If $Flag = True Then
Return
Else
AutoGO()
EndIf
EndIf
EndFunc ;==>autoinstall
Func _Flag()
$Flag = True
EndFunc ;==>_Flag
Func autoGO()
Dim $w = 0
For $i = 1 To $OBJMAX
If IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "A" & $i, "") = 1 And FileExists(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, "")) <> 0 Then
$w = $w + 1
GUICtrlSetData($Label1, $w & "/" & $p & " 正在安装" & IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "name" & $i, ""))
RunWait(IniRead(@WindowsDir & "\temp\SoftTool.ini", "soft", "auto" & $i, ""))
GUICtrlSetData($progressbar1, Int(100 / $p * $w))
EndIf
Next
Beep(1000, 100)
Sleep(200)
Beep(1000, 100)
Sleep(200)
Beep(1000, 100)
GUICtrlSetData($Label1, "^_^ 软件全部安装完毕!")
Sleep(2000)
If IniRead("soft\SoftTool.ini", "SoftTool", "autodelete", "") = 1 Then
Run(@ComSpec & " /c ping -n 2 127.1>nul & rd /s /q " & @ScriptDir & "\soft", @ScriptDir, @SW_HIDE)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q SoftTool.exe", @ScriptDir, @SW_HIDE)
EndIf
Exit
EndFunc ;==>autoinstall
Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$yChar = $aSB_WindowInfo[$index][3]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
Switch $nScrollCode
Case $SB_THUMBTRACK
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $yPos) Then
_GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
$yPos = $Pos
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_VSCROLL
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $xChar, $xPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
Switch $nScrollCode
Case $SB_THUMBTRACK
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then
_GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
$Pos = $xPos
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xClientMax = $aSB_WindowInfo[$index][1]
$xChar = $aSB_WindowInfo[$index][2]
$yChar = $aSB_WindowInfo[$index][3]
$ivMax = $aSB_WindowInfo[$index][7]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient
; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", $ivMax / 14.7 * ($OBJMAX))
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE |
|