Автор: ViSiToR
Дата сообщения: 10.11.2008 14:42
Tipulatoid
Вот что у меня [more=получилось]
Код: #include <GUIConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
;
HotKeySet("{F1}", "_CallAbout_Proc")
Global $aCover_GUIs[42]
Global $iOld_Left, $iOld_Top, $iScrollPos, $iFirstTime, $iScrollTimer, $iScrollSpeed = 1, $iCustom_ScrollSpeed = 3
Global $iLast_Mouse_YPos = -1, $iIsScrolling = False
Global $hIsPressed
Global $iScroll_Movie_Effect = False
$hParentGui = GUICreate('Parent For "About Program" Demo', 200, 100)
$Menu = GUICtrlCreateMenu("Help")
$AboutItem = GUICtrlCreateMenuItem("About... (F1)", $Menu)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $AboutItem
_CallAbout_Proc()
EndSwitch
WEnd
Func _CallAbout_Proc()
HotKeySet("{F1}")
$Title = "About Info"
$sScrollText = "I want to express special gratitude to:" & _
"\n\n\n\nAutoIt Team\n\n\nAutoIt Community\n\n\n... and many other good people"
$MainLabel = "My program Name"
$CopyRLabel = "Copyright © " & @YEAR & " Company/Author. All rights reserved."
$NameURL1 = "App Web Page"
$URL1 = "http://www.autoitscript.com"
$NameURL2 = "Email"
$URL2 = "mailto:my_email@mail.com"
$NameURL3 = "Some additional link"
$URL3 = "http://personalwebpafe.com"
$LinkColor = 0x0000FF
$BkColor = 0xFFFFFF
_AboutGUI($Title, $MainLabel, "Program version: " & @LF & "v1.0", $sScrollText, $CopyRLabel, _
$NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, $hParentGui, @AutoItExe, $LinkColor, $BkColor, 500, 300)
HotKeySet("{F1}", "_CallAbout_Proc")
EndFunc
Func _AboutGUI($sTitle, $sMainLabelText, $sBodyText, $sScrollText, $sCopyRText, $sNameURL1, $sURL1, $sNameURL2, $sURL2, $sNameURL3, $sURL3, $hParent = 0, $sIconFile = "", $nLinkColor = 0x0000FF, $nBkColor = 0xFFFFFF, $iWidth = 300, $iHeight = 120, $iLeft = -1, $iTop = -1, $nStyle = -1, $nExStyle = -1)
Local $iOldEventOpt = Opt("GUIOnEventMode", 0)
Local $hAbout_GUI, $hScroll_GUI, $iAbout_Msg, $aCurInfo
Local $aCurIsOnCtrlArr[1]
Local $aLinkVisitedColor[4] = [3, $nLinkColor, $nLinkColor, $nLinkColor]
Local $aLinkLabel[4], $iLinkTop = 120
WinSetState($hParent, "", @SW_DISABLE)
If $nExStyle = -1 Then $nExStyle = ""
Local $hAbout_GUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, $nStyle, 0x00000080 + $nExStyle, $hParent)
GUICtrlCreateLabel($sMainLabelText, 0, 20, $iWidth, 25, $ES_CENTER)
GUICtrlSetFont(-1, 14)
GUICtrlCreateIcon($sIconFile, 0, 10, 20)
GUICtrlSetState(-1, 128)
GUICtrlCreateGraphic(5, 75, $iWidth - 10, 3, $SS_ETCHEDFRAME)
For $i = 1 To 3
$aLinkLabel[$i] = GUICtrlCreateLabel(Eval("sNameURL" & $i), $iWidth - 150, $iLinkTop, 145, 15, 1)
GUICtrlSetCursor(-1, 0)
GUICtrlSetColor(-1, $nLinkColor)
GUICtrlSetFont(-1, 9, 400, 0)
GUICtrlSetTip(-1, Eval("sURL" & $i))
$iLinkTop += 30
Next
GUICtrlCreateLabel($sBodyText, 10, 100, 140, 35)
GUICtrlSetFont(-1, 10, 600, 0, "Tahoma")
GUICtrlCreateLabel($sCopyRText, 0, $iHeight - 20, $iWidth, -1, 1)
GUICtrlSetColor(-1, 0x969696)
GUICtrlSetState(-1, 128)
If Not $iScroll_Movie_Effect Then
$hScroll_GUI = GUICreate('', 180, 160, 150, 90, $WS_CHILD, -1, $hAbout_GUI)
Else
$hScroll_GUI = GUICreate('', 180, 160, 150, 90, $WS_CHILD, $WS_EX_CLIENTEDGE+$WS_EX_DLGMODALFRAME, $hAbout_GUI)
GUISetBkColor(0x0)
EndIf
Local $Scroll_Label = GUICtrlCreateLabel(StringFormat($sScrollText), 0, 70, 180, 510, $ES_CENTER)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetCursor(-1, 0)
GUICtrlSetFont(-1, 10)
If Not $iScroll_Movie_Effect Then
GUICtrlSetColor(-1, 0x804000)
Else
GUICtrlSetColor(-1, 0xFFFFFF)
EndIf
Dim $iScrollPos = -70, $iFirstTime = 1, $iScrollTimer = TimerInit()
Local $iTransHeight = 2, $iTransValue = (UBound($aCover_GUIs)/2) - 1, $aParentPos = WinGetPos($hAbout_GUI)
If $iScroll_Movie_Effect Then $iTransHeight = 1
$iOld_Left = $aParentPos[0]
$iOld_Top = $aParentPos[1]
For $i = 0 To $iTransValue
;Top Cover
$aCover_GUIs[$i] = GUICreate("", 220, $iTransHeight + 2, _
130 + $aParentPos[0], $iTransHeight * $i + 110 + $aParentPos[1], _
$WS_POPUP, -1, $hAbout_GUI) ;$WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
WinSetTrans($aCover_GUIs[$i], "", (255 / $iTransValue) * (-1 * ($i - $iTransValue)))
;Bottom cover
$aCover_GUIs[$i + $iTransValue + 1] = GUICreate("", 220, $iTransHeight + 2, _
130 + $aParentPos[0], 260 - $iTransHeight * $i + $aParentPos[1] + 20, _
$WS_POPUP, -1, $hAbout_GUI) ;, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
WinSetTrans($aCover_GUIs[$i + $iTransValue + 1], "", (255 / $iTransValue) * (-1 * ($i - $iTransValue)))
Next
GUISetState(@SW_SHOW, $hAbout_GUI)
GUISetState(@SW_SHOW, $hScroll_GUI)
For $i = 0 To 41
GUISetState(@SW_SHOW, $aCover_GUIs[$i])
Next
GUICtrlSetState($Scroll_Label, $GUI_SHOW)
$hIsPressed = DllOpen("User32.dll")
Local $hCallBack = DllCallbackRegister("_ScrollText_CallBack_Proc", "none", "hwnd;int;int;dword")
Local $ahTimer = DllCall("user32.dll", "int", "SetTimer", _
"hwnd", $hScroll_GUI, "int", 1001, "int", 15, "ptr", DllCallbackGetPtr($hCallBack))
GUISwitch($hAbout_GUI)
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
WinActivate($hAbout_GUI)
SoundPlay(@SystemDir & "\oobe\images\title.wma", 0)
While 1
$iAbout_Msg = GUIGetMsg()
Switch $iAbout_Msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $aLinkLabel[1], $aLinkLabel[2], $aLinkLabel[3]
GUISetCursor(0, 1, $hAbout_GUI)
$aCurInfo = GUIGetCursorInfo($hAbout_GUI)
If $iAbout_Msg = $aLinkLabel[1] Then $i = 1
If $iAbout_Msg = $aLinkLabel[2] Then $i = 2
If $iAbout_Msg = $aLinkLabel[3] Then $i = 3
While $aCurInfo[2] = 1
$aCurInfo = GUIGetCursorInfo($hAbout_GUI)
Sleep(10)
WEnd
If $aCurInfo[4] = $iAbout_Msg Then
GUISetCursor(-1, 0, $hAbout_GUI)
$aLinkVisitedColor[$i] = 0xAC00A9
GUICtrlSetColor($iAbout_Msg, $aLinkVisitedColor[$i])
ShellExecute(Eval("sURL" & $i))
EndIf
GUISetCursor(-1, 0, $hAbout_GUI)
EndSwitch
Sleep(30)
_ControlHover_Proc($hAbout_GUI, $aLinkLabel[1], 1, $aCurIsOnCtrlArr, 0xFF0000, $aLinkVisitedColor[1])
_ControlHover_Proc($hAbout_GUI, $aLinkLabel[2], 2, $aCurIsOnCtrlArr, 0xFF0000, $aLinkVisitedColor[2])
_ControlHover_Proc($hAbout_GUI, $aLinkLabel[3], 3, $aCurIsOnCtrlArr, 0xFF0000, $aLinkVisitedColor[3])
WEnd
DllCall("user32.dll", "int", "KillTimer", "hwnd", $hScroll_GUI, "int", $ahTimer[0])
DllCallbackFree($hCallBack)
DllClose($hIsPressed)
GUIRegisterMsg($WM_MOVE, "")
SoundPlay("")
For $i = 0 To 41
GUIDelete($aCover_GUIs[$i])
Next
WinSetState($hParent, "", @SW_ENABLE)
GUIDelete($hAbout_GUI)
GUISwitch($hParent)
Opt("GUIOnEventMode", $iOldEventOpt)
EndFunc ;==>_AboutGUI
Func _ScrollText_CallBack_Proc($hWnd, $iMsg, $wParam, $lParam)
Local $hScroll_Label_Wnd = ControlGetHandle($hWnd, "", "Static1")
Local $iScroll_Label_Ctrl = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hScroll_Label_Wnd)
$iScroll_Label_Ctrl = $iScroll_Label_Ctrl[0]
If ($iIsScrolling Or _Control_GetHovered() = $hScroll_Label_Wnd) And _IsPressed(01, $hIsPressed) Then
Local $iCurrent_Mouse_YPos = MouseGetPos(1)
$iIsScrolling = True
If $iLast_Mouse_YPos < $iCurrent_Mouse_YPos Then ;Move up
$iScrollPos -= $iCustom_ScrollSpeed
ControlMove($hWnd, "", "Static1", 0, -$iScrollPos)
ElseIf $iLast_Mouse_YPos > $iCurrent_Mouse_YPos Then ;Move down
$iScrollPos += $iCustom_ScrollSpeed
ControlMove($hWnd, "", "Static1", 0, -$iScrollPos)
EndIf
GUICtrlSetCursor($iScroll_Label_Ctrl, 11)
$iLast_Mouse_YPos = $iCurrent_Mouse_YPos
$iScrollTimer = TimerInit()
$iFirstTime = 1
If $iScrollPos > 250 Or $iScrollPos < -250 Then $iScrollPos = -150
Return
Else
$iIsScrolling = False
GUICtrlSetCursor($iScroll_Label_Ctrl, 0)
EndIf
If ($iFirstTime And TimerDiff($iScrollTimer) > 1000) Or (Not $iFirstTime And TimerDiff($iScrollTimer) > 30) Then
$iFirstTime = 0
$iScrollTimer = TimerInit()
$iScrollPos += $iScrollSpeed
ControlMove($hWnd, "", "Static1", 0, -$iScrollPos)
If $iScrollPos > 250 Then $iScrollPos = -150
EndIf
;WM_MOVE($hAbout_GUI, 0, 0, 0)
EndFunc ;==>_ScrollText_CallBack_Proc
Func WM_MOVE($hWndGUI, $MsgID, $wParam, $lParam)
Local $aParentPosArr, $aChildPosArr, $iNew_Left, $iNew_Top
$aParentPosArr = WinGetPos($hWndGUI)
For $i = 0 To 41
$aChildPosArr = WinGetPos($aCover_GUIs[$i])
$iNew_Left = $aChildPosArr[0]
$iNew_Top = $aChildPosArr[1]
If $iOld_Left > $aParentPosArr[0] Then
$iNew_Left = $aChildPosArr[0] + ($aParentPosArr[0] - $iOld_Left)
ElseIf $iOld_Left < $aParentPosArr[0] Then
$iNew_Left = $aChildPosArr[0] - ($iOld_Left - $aParentPosArr[0])
EndIf
If $iOld_Top > $aParentPosArr[1] Then
$iNew_Top = $aChildPosArr[1] - ($iOld_Top - $aParentPosArr[1])
ElseIf $iOld_Top < $aParentPosArr[1] Then
$iNew_Top = $aChildPosArr[1] + ($aParentPosArr[1] - $iOld_Top)
EndIf
If $iOld_Left = $iNew_Left And $iOld_Top = $iNew_Top Then Return
WinMove($aCover_GUIs[$i], "", $iNew_Left, $iNew_Top)
Next
$iOld_Left = $aParentPosArr[0]
$iOld_Top = $aParentPosArr[1]
EndFunc ;==>WM_MOVE
Func _Control_GetHovered()
Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)
Local $Ret = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
Opt("MouseCoordMode", $iOld_Opt_MCM)
Return HWnd($Ret[0])
EndFunc ;==>_Control_GetHovered
Func _ControlHover_Proc($hWnd, $iCtrlID, $iCtrlNum, ByRef $aCurIsOnCtrlArr, $nHoverColor = 0xFF0000, $nLinkColor = 0x0000FF)
Local $aCursorCtrl = GUIGetCursorInfo($hWnd)
ReDim $aCurIsOnCtrlArr[UBound($aCurIsOnCtrlArr) + 1]
If $aCursorCtrl[4] = $iCtrlID And $aCurIsOnCtrlArr[$iCtrlNum] = 1 Then
GUICtrlSetFont($iCtrlID, 9, 400, 6)
GUICtrlSetColor($iCtrlID, $nHoverColor)
$aCurIsOnCtrlArr[$iCtrlNum] = 0
ElseIf $aCursorCtrl[4] <> $iCtrlID And $aCurIsOnCtrlArr[$iCtrlNum] = 0 Then
GUICtrlSetFont($iCtrlID, 9, 400, 0)
GUICtrlSetColor($iCtrlID, $nLinkColor)
$aCurIsOnCtrlArr[$iCtrlNum] = 1
EndIf
EndFunc ;==>_ControlHover_Proc