找回密码
 加入
搜索
楼主: smooth

[AU3基础] [已解决]请问如何在GUI控件上插入超链接?

[复制链接]
发表于 2009-9-27 12:50:26 | 显示全部楼层
代码不全,无法测试,只能猜到如此
 楼主| 发表于 2009-9-27 12:53:01 | 显示全部楼层
本帖最后由 smooth 于 2009-9-27 13:15 编辑
代码不全,无法测试,只能猜到如此
afan 发表于 2009-9-27 12:50
……
;
GUICtrlCreateLabel("鼎盛技术,开创未来!", 260, 300, 130, 14)
GUICtrlSetFont(-1, 10, 400)
;
$lj = GUICtrlCreateLabel("访问鼎盛中国网站", 260, 325,96, 14)
GUICtrlSetCursor(-1, 0)
;
Global $vPartEdge[2], $vPartText[2]
$vPartEdge[0] = 200
$vPartEdge[1] = 400
$vPartText[0] = '  今天日期是:' & @YEAR & '年 ' & @MON & '月 ' & @MDAY & '日'
$vPartText[1] = '  Coded by 鼎盛中国,QQ:93737788'
_GUICtrlStatusBar_Create($Form, $vPartEdge, $vPartText)

_Set(GUICtrlRead($Date))
GUISetState(@SW_SHOW);窗口创建后是处于隐藏状态的,因此您必须使用本函数来使它们显示出来(@SW_SHOW).

Dim $bj = 0
While 1
        $zt = GUIGetCursorInfo($Form);获取(相对于 GUI 窗口的)鼠标位置.
        If $zt[4] = $lj And $bj = 0 Then
                GUICtrlSetFont($lj, 9, 400, 4)
                GUICtrlSetColor($lj, 0x0000FF)
                $bj = 1
        ElseIf $zt[4] <> $lj And $bj = 1 Then
                GUICtrlSetFont($lj, 9, 400, 0)
                GUICtrlSetColor($lj, 0x000000)
                $bj = 0
        EndIf
            $nMsg = GUIGetMsg()
            Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                            _UnLoadSkin($hSkinDll)
                            FileDelete($SkinFile)
                            FileDelete($SkinDll)
                        Exit
                    Case $Date
                            _Set(GUICtrlRead($Date))
                            _Write($IniFile, 'Baby', 'PregnantDate', GUICtrlRead($Date))
                        Case - 3
                                Exit
                    Case $lj
                    ShellExecute("http://hi.baidu.com/cnace")
        EndSwitch
WEnd
……
发表于 2009-9-27 12:57:53 | 显示全部楼层
我这显示的字“很蓝”...
你那是使用皮肤的问题
 楼主| 发表于 2009-9-27 13:08:40 | 显示全部楼层
本帖最后由 smooth 于 2009-9-27 13:10 编辑
我这显示的字“很蓝”...
你那是使用皮肤的问题
afan 发表于 2009-9-27 12:57


是的。谢谢你了。我这个设计是参照你的的代码的。谢谢。

如果我要实现,能用鼠标右键点击任务栏通知区域的AU3程序选择“退出”,要加入什么代码呢?
发表于 2009-9-27 13:27:55 | 显示全部楼层
Opt("TrayMenuMode", 1) 把这句注释掉不就行了~
 楼主| 发表于 2009-9-27 13:38:50 | 显示全部楼层
Opt("TrayMenuMode", 1) 把这句注释掉不就行了~
afan 发表于 2009-9-27 13:27


是可以。但是我能修改点击右键之后弹出来的文字么?
发表于 2009-9-27 13:47:12 | 显示全部楼层
那就不要注释掉,且需另外创建菜单。参考下帮助里的 TrayCreateItem 例子
 楼主| 发表于 2009-9-27 14:06:56 | 显示全部楼层
那就不要注释掉,且需另外创建菜单。参考下帮助里的 TrayCreateItem 例子
afan 发表于 2009-9-27 13:47


好的。我先自己研究,不懂再问你。哥们QQ留个。我加你。
发表于 2009-9-27 14:09:42 | 显示全部楼层
不用QQ,只泡论坛
 楼主| 发表于 2009-9-27 14:15:09 | 显示全部楼层
本帖最后由 smooth 于 2009-9-27 14:50 编辑
不用QQ,只泡论坛
afan 发表于 2009-9-27 14:09


达人都这样,不上QQ。只泡论坛。那就算了
 楼主| 发表于 2009-9-27 14:50:49 | 显示全部楼层
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=include\Baby.ico
#AutoIt3Wrapper_outfile=..\..\BabyBirth.exe
#AutoIt3Wrapper_Res_Comment=程序设计:鼎盛中国。你可以自由使用、分发本程序,但严禁用于商业用途。
#AutoIt3Wrapper_Res_Description=宝宝出生日期计算器
#AutoIt3Wrapper_Res_Fileversion=5.8.8.5
#AutoIt3Wrapper_Res_LegalCopyright=鼎盛中国保留所有权利
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****

#cs ____________________________________
        
        Au3 版本: 3.3.0.0
        脚本设计:鼎盛中国 
        脚本功能: 宝宝出生倒计时计算器
        
#ce _______________脚本开始_________________

#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#include <GuiStatusBar.au3>
#include <Date.au3>

#Include <Constants.au3>
#NoTrayIcon
 
Opt("TrayMenuMode", 1); 默认托盘菜单项目(脚本已暂停/退出脚本) (Script Paused/Exit) 将不显示.
Opt('TrayAutoPause', 0)
Opt("MustDeclareVars")

Global $Title = "宝宝出生倒计时计算器"
If WinExists($Title) Then Exit
AutoItWinSetTitle($Title)

Global $Form = GUICreate($Title, 425, 401, -1, -1)

Global $SkinFile = @TempDir & '\Skin.skf', _
                $SkinDll = @TempDir & '\SkinCrafter.dll'
FileInstall('include\Skin.skf', $SkinFile, 1)
FileInstall('include\SkinCrafter.dll', $SkinDll, 1)
Global $hSkinDll = _LoadSkin($SkinFile, $SkinDll, $Form)

Global $IniFile = StringLeft(@ScriptFullPath, StringInStr(@ScriptFullPath, '.', 0, -1)) & 'ini'

GUICtrlCreateGroup("献给未来出生的宝宝的小礼物", 8, 8, 409, 361)
GUICtrlCreateGroup("", 24, 24, 225, 64)
GUICtrlCreateLabel("请输入怀孕日期:", 40, 52, 100, 17)
$Date = GUICtrlCreateDate(IniRead($IniFile, 'Baby', 'PregnantDate', @YEAR & '-' & @MON & '-' & @MDAY), 144, 48, 90, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global $Image = @TempDir & '\Baby.jpg'
FileInstall('include\Baby.jpg', $Image, 1)
GUICtrlCreatePic($Image, 260, 29, 140, 60, 0)
FileDelete($Image)

GUICtrlCreateGroup("预测结果", 24, 96, 377, 96)
;
GUICtrlCreateLabel("宝宝出生日期是:", 40, 126, 100, 17)
$Input1 = GUICtrlCreateInput("", 144, 118, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("年", 200, 126, 16, 17)
$Input2 = GUICtrlCreateInput("", 224, 118, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("月", 264, 126, 16, 17)
$Input3 = GUICtrlCreateInput("", 280, 118, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("日", 320, 126, 16, 17)
;
GUICtrlCreateLabel("今天是孕期第:", 40, 162, 100, 17)
$Input4 = GUICtrlCreateInput("", 144, 154, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("周,零", 184, 162, 40, 17)
$Input5 = GUICtrlCreateInput("", 224, 154, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 162, 52, 17)
$Input6 = GUICtrlCreateInput("", 320, 154, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 162, 28, 17)

GUICtrlCreateGroup("宝宝出生倒计时", 24, 200, 377, 153)
;
GUICtrlCreateLabel("离宝宝出生还有:", 40, 230, 100, 17)
$Input7 = GUICtrlCreateInput("", 140, 222, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("月,零", 184, 230, 40, 17)
$Input8 = GUICtrlCreateInput("", 224, 222, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 230, 52, 17)
$Input9 = GUICtrlCreateInput("", 316, 222, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 230, 28, 17)
;
GUICtrlCreateLabel("离宝宝出生还有:", 40, 266, 100, 17)
$Input10 = GUICtrlCreateInput("", 140, 260, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("周,零", 184, 266, 40, 17)
$Input11 = GUICtrlCreateInput("", 224, 260, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 266, 52, 17)
$Input12 = GUICtrlCreateInput("", 316, 260, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 266, 28, 17)
;
GUICtrlCreateLabel("祝:母子平安,阖家幸福!", 39, 310, 200, 24)
GUICtrlSetFont(-1, 11, 800)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;
GUICtrlCreateLabel("鼎盛技术,开创未来!", 260, 300, 130, 14)
GUICtrlSetFont(-1, 10, 400)
;
$lj = GUICtrlCreateLabel("访问鼎盛中国网站", 260, 325,96, 14)
GUICtrlSetCursor(-1, 0)
;
Global $vPartEdge[2], $vPartText[2]
$vPartEdge[0] = 200
$vPartEdge[1] = 400
$vPartText[0] = '  今天日期是:' & @YEAR & '年 ' & @MON & '月 ' & @MDAY & '日'
$vPartText[1] = '  Coded by 鼎盛中国,QQ:93737788'
_GUICtrlStatusBar_Create($Form, $vPartEdge, $vPartText)

_Set(GUICtrlRead($Date))
GUISetState(@SW_SHOW);窗口创建后是处于隐藏状态的,因此您必须使用本函数来使它们显示出来(@SW_SHOW).

Dim $bj = 0
While 1
        $zt = GUIGetCursorInfo($Form);获取(相对于 GUI 窗口的)鼠标位置.
        If $zt[4] = $lj And $bj = 0 Then
                GUICtrlSetFont($lj, 9, 400, 4)
                GUICtrlSetColor($lj, 0x0000FF)
                $bj = 1
        ElseIf $zt[4] <> $lj And $bj = 1 Then
                GUICtrlSetFont($lj, 9, 400, 0)
                GUICtrlSetColor($lj, 0x000000)
                $bj = 0
        EndIf
            $nMsg = GUIGetMsg()
            Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                            _UnLoadSkin($hSkinDll)
                            FileDelete($SkinFile)
                            FileDelete($SkinDll)
                        Exit
                    Case $Date
                            _Set(GUICtrlRead($Date))
                            _Write($IniFile, 'Baby', 'PregnantDate', GUICtrlRead($Date))
                        Case - 3
                                Exit
                    Case $lj
                    ShellExecute("http://hi.baidu.com/cnace")
        EndSwitch
WEnd
        
Func _Set($dPregnantDate)
        Local $sPregnantDate, $sToday, $sDateOfBirth, $iDayToBirth, $iDayForPregnant

        ;处理怀孕日期,获取 年 月 日(因受精当天算入孕期第一天,为方便计算,“日”往前推一天)
        Local $t = StringSplit($dPregnantDate, '-')
        Local $iYear = $t[1], _
                        $iMonth = $t[2], _
                        $iDay = $t[3]

        ;获取怀孕日期的 Juliandate
        $sPregnantDate = _DateToDayValue($iYear, $iMonth, $iDay) - 1
        ;获取当前系统日期的 Juliandate
        $sToday = _DateToDayValue(@YEAR, @MON, @MDAY)

        ;分别计算出 1.出生日期的 Juliandate; 2.离出生的天数; 3.怀孕天数
        $sDateOfBirth = $sPregnantDate + 281
        $iDayToBirth = $sDateOfBirth - $sToday
        $iDayForPregnant = $sToday - $sPregnantDate

        If $sPregnantDate > 0 Then
                Select
                        Case $iDayForPregnant <= 0 ;当 怀孕天数 <=0 时,还没有怀孕,不显示 “孕期”,只显示 “出生日期”、“出生倒计时”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant('', 0)
                                _Show_DayToBirth($iDayToBirth)
                        Case $iDayForPregnant <= 280 ;当 0< 怀孕天数 <=280 时,正常显示 “出生日期”、“孕期”、“出生倒计时”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant($iDayForPregnant)
                                _Show_DayToBirth($iDayToBirth)
                        Case $iDayForPregnant > 280 ;当 怀孕天数 >280 时,不显示 “孕期”、“出生倒计时”,只显示 “出生日期”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant('', 0)
                                _Show_DayToBirth('', 0)
                EndSelect
        Else
                _Show_DateOfBirth('', 0)
                _Show_DayForPregnant('', 0)
                _Show_DayToBirth('', 0)
        EndIf
EndFunc   ;==>_Set

Func _Show_DateOfBirth($sDateOfBirth, $iMode = 1)
        If $iMode == 1 Then
                Local $iYear, $iMonth, $iDay
                _DayValueToDate($sDateOfBirth, $iYear, $iMonth, $iDay)
                GUICtrlSetData($Input1, $iYear)
                GUICtrlSetData($Input2, $iMonth)
                GUICtrlSetData($Input3, $iDay)
        Else
                GUICtrlSetData($Input1, '')
                GUICtrlSetData($Input2, '')
                GUICtrlSetData($Input3, '')
        EndIf
EndFunc   ;==>_Show_DateOfBirth

Func _Show_DayForPregnant($iDayForPregnant, $iMode = 1)
        If $iMode == 1 Then
                Local $iWeekNum = Floor($iDayForPregnant / 7), _
                                $iDayNum = Mod($iDayForPregnant, 7), _
                                $iDayTotal = $iDayForPregnant
                GUICtrlSetData($Input4, $iWeekNum)
                GUICtrlSetData($Input5, $iDayNum)
                GUICtrlSetData($Input6, $iDayTotal)
        Else
                GUICtrlSetData($Input4, '')
                GUICtrlSetData($Input5, '')
                GUICtrlSetData($Input6, '')
        EndIf
EndFunc   ;==>_Show_DayForPregnant

Func _Show_DayToBirth($iDayToBirth, $iMode = 1)
        If $iMode == 1 Then
                Local $iMonthNum = Floor($iDayToBirth / 30), _
                                $iDayNum = Mod($iDayToBirth, 30), _
                                $iDayTotal = $iDayToBirth
                If $iDayTotal > 9999 Then
                        $iMonthNum = '???'
                        $iDayNum = '??'
                        $iDayTotal = '????'
                EndIf
                GUICtrlSetData($Input7, $iMonthNum)
                GUICtrlSetData($Input8, $iDayNum)
                GUICtrlSetData($Input9, $iDayTotal)
                ;
                Local $iWeekNum = Floor($iDayToBirth / 7), _
                                $iDayNum = Mod($iDayToBirth, 7), _
                                $iDayTotal = $iDayToBirth
                If $iWeekNum > 999 Then
                        $iWeekNum = '???'
                        $iDayNum = '??'
                        $iDayTotal = '????'
                EndIf
                GUICtrlSetData($Input10, $iWeekNum)
                GUICtrlSetData($Input11, $iDayNum)
                GUICtrlSetData($Input12, $iDayTotal)
        Else
                GUICtrlSetData($Input7, '')
                GUICtrlSetData($Input8, '')
                GUICtrlSetData($Input9, '')
                GUICtrlSetData($Input10, '')
                GUICtrlSetData($Input11, '')
                GUICtrlSetData($Input12, '')
        EndIf
EndFunc   ;==>_Show_DayToBirth

Func _Write($sFile, $sSection, $sKey, $dPregnantDate)
        ;处理怀孕日期,获取 年 月 日, 给 月 日 的一位数字补0 (如 09月 09日)
        Local $t = StringSplit($dPregnantDate, '-')
        Local $iYear = $t[1], _
                        $iMonth = $t[2], _
                        $iDay = $t[3]
        $dPregnantDate = $iYear & '-' & StringRight('0' & $iMonth, 2) & '-' & StringRight('0' & $iDay, 2)

        ;写入配置文件
        IniWrite($sFile, $sSection, $sKey, $dPregnantDate)

EndFunc   ;==>_Write

Func _LoadSkin($sSkinFile, $sSkinDll, $cForm)
        Local $hSkinDll = DllOpen($sSkinDll)
        DllCall($hSkinDll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
        DllCall($hSkinDll, "int:cdecl", "InitDecoration", "int", 1)
        DllCall($hSkinDll, "int:cdecl", "LoadSkinFromFile", "wstr", $sSkinFile)
        DllCall($hSkinDll, "int:cdecl", "DecorateAs", "int", $cForm, "int", 25)
        DllCall($hSkinDll, "int:cdecl", "ApplySkin")
        Return $hSkinDll
EndFunc   ;==>_LoadSkin

Func _UnLoadSkin($hSkinDll)
        GUISetState(@SW_HIDE)
        DllCall($hSkinDll, "int:cdecl", "DeInitDecoration")
        DllCall($hSkinDll, "int:cdecl", "RemoveSkin")
        DllClose($hSkinDll)
EndFunc   ;==>_UnLoadSkin

$prefsitem  = TrayCreateItem("参数")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("关于")
TrayCreateItem("")
$exititem   = TrayCreateItem("退出")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $prefsitem
            Msgbox(64, "参数:", "系统版本:" & @OSVersion)
        Case $msg = $aboutitem
            Msgbox(64, "关于:", "宝宝出生日期计算器 5.8.8.5")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit
怎么我舔加了托盘事件之后,托盘图标都不显示出来了。。。。。。。
发表于 2009-9-27 14:59:10 | 显示全部楼层
本帖最后由 afan 于 2009-9-27 15:58 编辑

插的位置不对...
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=include\Baby.ico
#AutoIt3Wrapper_Outfile=..\..\BabyBirth.exe
#AutoIt3Wrapper_Res_Comment=程序设计:鼎盛中国。你可以自由使用、分发本程序,但严禁用于商业用途。
#AutoIt3Wrapper_Res_Description=宝宝出生日期计算器
#AutoIt3Wrapper_Res_Fileversion=5.8.8.5
#AutoIt3Wrapper_Res_LegalCopyright=鼎盛中国保留所有权利
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****

#cs ____________________________________
        
        Au3 版本: 3.3.0.0
        脚本设计:鼎盛中国
        脚本功能: 宝宝出生倒计时计算器
        
#ce _______________脚本开始_________________

#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#include <GuiStatusBar.au3>
#include <Date.au3>

#include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode", 1); 默认托盘菜单项目(脚本已暂停/退出脚本) (Script Paused/Exit) 将不显示.
Opt('TrayAutoPause', 0)
Opt("MustDeclareVars")

Global $Title = "宝宝出生倒计时计算器"
If WinExists($Title) Then Exit
AutoItWinSetTitle($Title)

Global $Form = GUICreate($Title, 425, 401, -1, -1)

Global $SkinFile = @TempDir & '\Skin.skf', _
                $SkinDll = @TempDir & '\SkinCrafter.dll'
FileInstall('include\Skin.skf', $SkinFile, 1)
FileInstall('include\SkinCrafter.dll', $SkinDll, 1)
Global $hSkinDll = _LoadSkin($SkinFile, $SkinDll, $Form)

Global $IniFile = StringLeft(@ScriptFullPath, StringInStr(@ScriptFullPath, '.', 0, -1)) & 'ini'

GUICtrlCreateGroup("献给未来出生的宝宝的小礼物", 8, 8, 409, 361)
GUICtrlCreateGroup("", 24, 24, 225, 64)
GUICtrlCreateLabel("请输入怀孕日期:", 40, 52, 100, 17)
$Date = GUICtrlCreateDate(IniRead($IniFile, 'Baby', 'PregnantDate', @YEAR & '-' & @MON & '-' & @MDAY), 144, 48, 90, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global $Image = @TempDir & '\Baby.jpg'
FileInstall('include\Baby.jpg', $Image, 1)
GUICtrlCreatePic($Image, 260, 29, 140, 60, 0)
FileDelete($Image)

GUICtrlCreateGroup("预测结果", 24, 96, 377, 96)
;
GUICtrlCreateLabel("宝宝出生日期是:", 40, 126, 100, 17)
$Input1 = GUICtrlCreateInput("", 144, 118, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("年", 200, 126, 16, 17)
$Input2 = GUICtrlCreateInput("", 224, 118, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("月", 264, 126, 16, 17)
$Input3 = GUICtrlCreateInput("", 280, 118, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("日", 320, 126, 16, 17)
;
GUICtrlCreateLabel("今天是孕期第:", 40, 162, 100, 17)
$Input4 = GUICtrlCreateInput("", 144, 154, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("周,零", 184, 162, 40, 17)
$Input5 = GUICtrlCreateInput("", 224, 154, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 162, 52, 17)
$Input6 = GUICtrlCreateInput("", 320, 154, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 162, 28, 17)

GUICtrlCreateGroup("宝宝出生倒计时", 24, 200, 377, 153)
;
GUICtrlCreateLabel("离宝宝出生还有:", 40, 230, 100, 17)
$Input7 = GUICtrlCreateInput("", 140, 222, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("月,零", 184, 230, 40, 17)
$Input8 = GUICtrlCreateInput("", 224, 222, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 230, 52, 17)
$Input9 = GUICtrlCreateInput("", 316, 222, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 230, 28, 17)
;
GUICtrlCreateLabel("离宝宝出生还有:", 40, 266, 100, 17)
$Input10 = GUICtrlCreateInput("", 140, 260, 41, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("周,零", 184, 266, 40, 17)
$Input11 = GUICtrlCreateInput("", 224, 260, 33, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天(合计", 264, 266, 52, 17)
$Input12 = GUICtrlCreateInput("", 316, 260, 49, 25, BitOR($ES_RIGHT, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetFont(-1, 13, 800)
GUICtrlCreateLabel("天)", 368, 266, 28, 17)
;
GUICtrlCreateLabel("祝:母子平安,阖家幸福!", 39, 310, 200, 24)
GUICtrlSetFont(-1, 11, 800)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;
GUICtrlCreateLabel("鼎盛技术,开创未来!", 260, 300, 130, 14)
GUICtrlSetFont(-1, 10, 400)
;
$lj = GUICtrlCreateLabel("访问鼎盛中国网站", 260, 325, 96, 14)
GUICtrlSetCursor(-1, 0)
;
Global $vPartEdge[2], $vPartText[2]
$vPartEdge[0] = 200
$vPartEdge[1] = 400
$vPartText[0] = '  今天日期是:' & @YEAR & '年 ' & @MON & '月 ' & @MDAY & '日'
$vPartText[1] = '  Coded by 鼎盛中国,QQ:93737788'
_GUICtrlStatusBar_Create($Form, $vPartEdge, $vPartText)

_Set(GUICtrlRead($Date))
GUISetState(@SW_SHOW);窗口创建后是处于隐藏状态的,因此您必须使用本函数来使它们显示出来(@SW_SHOW).

$prefsitem = TrayCreateItem("参数")
TrayCreateItem("")
$aboutitem = TrayCreateItem("关于")
TrayCreateItem("")
$exititem = TrayCreateItem("退出")
TraySetState()

Dim $bj = 0
While 1
        $zt = GUIGetCursorInfo($Form);获取(相对于 GUI 窗口的)鼠标位置.
        If $zt[4] = $lj And $bj = 0 Then
                GUICtrlSetFont($lj, 9, 400, 4)
                GUICtrlSetColor($lj, 0x0000FF)
                $bj = 1
        ElseIf $zt[4] <> $lj And $bj = 1 Then
                GUICtrlSetFont($lj, 9, 400, 0)
                GUICtrlSetColor($lj, 0x000000)
                $bj = 0
        EndIf

        $msg = TrayGetMsg()
        Select
                Case $msg = $prefsitem
                        MsgBox(64, "参数:", "系统版本:" & @OSVersion)
                Case $msg = $aboutitem
                        MsgBox(64, "关于:", "宝宝出生日期计算器 5.8.8.5")
                Case $msg = $exititem
                        ExitLoop
        EndSelect

        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        _UnLoadSkin($hSkinDll)
                        FileDelete($SkinFile)
                        FileDelete($SkinDll)
                        Exit
                Case $Date
                        _Set(GUICtrlRead($Date))
                        _Write($IniFile, 'Baby', 'PregnantDate', GUICtrlRead($Date))
                Case - 3
                        Exit
                Case $lj
                        ShellExecute("http://hi.baidu.com/cnace")
        EndSwitch
WEnd

Func _Set($dPregnantDate)
        Local $sPregnantDate, $sToday, $sDateOfBirth, $iDayToBirth, $iDayForPregnant

        ;处理怀孕日期,获取 年 月 日(因受精当天算入孕期第一天,为方便计算,“日”往前推一天)
        Local $t = StringSplit($dPregnantDate, '-')
        Local $iYear = $t[1], _
                        $iMonth = $t[2], _
                        $iDay = $t[3]

        ;获取怀孕日期的 Juliandate
        $sPregnantDate = _DateToDayValue($iYear, $iMonth, $iDay) - 1
        ;获取当前系统日期的 Juliandate
        $sToday = _DateToDayValue(@YEAR, @MON, @MDAY)

        ;分别计算出 1.出生日期的 Juliandate; 2.离出生的天数; 3.怀孕天数
        $sDateOfBirth = $sPregnantDate + 281
        $iDayToBirth = $sDateOfBirth - $sToday
        $iDayForPregnant = $sToday - $sPregnantDate

        If $sPregnantDate > 0 Then
                Select
                        Case $iDayForPregnant <= 0 ;当 怀孕天数 <=0 时,还没有怀孕,不显示 “孕期”,只显示 “出生日期”、“出生倒计时”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant('', 0)
                                _Show_DayToBirth($iDayToBirth)
                        Case $iDayForPregnant <= 280 ;当 0< 怀孕天数 <=280 时,正常显示 “出生日期”、“孕期”、“出生倒计时”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant($iDayForPregnant)
                                _Show_DayToBirth($iDayToBirth)
                        Case $iDayForPregnant > 280 ;当 怀孕天数 >280 时,不显示 “孕期”、“出生倒计时”,只显示 “出生日期”
                                _Show_DateOfBirth($sDateOfBirth)
                                _Show_DayForPregnant('', 0)
                                _Show_DayToBirth('', 0)
                EndSelect
        Else
                _Show_DateOfBirth('', 0)
                _Show_DayForPregnant('', 0)
                _Show_DayToBirth('', 0)
        EndIf
EndFunc   ;==>_Set

Func _Show_DateOfBirth($sDateOfBirth, $iMode = 1)
        If $iMode == 1 Then
                Local $iYear, $iMonth, $iDay
                _DayValueToDate($sDateOfBirth, $iYear, $iMonth, $iDay)
                GUICtrlSetData($Input1, $iYear)
                GUICtrlSetData($Input2, $iMonth)
                GUICtrlSetData($Input3, $iDay)
        Else
                GUICtrlSetData($Input1, '')
                GUICtrlSetData($Input2, '')
                GUICtrlSetData($Input3, '')
        EndIf
EndFunc   ;==>_Show_DateOfBirth

Func _Show_DayForPregnant($iDayForPregnant, $iMode = 1)
        If $iMode == 1 Then
                Local $iWeekNum = Floor($iDayForPregnant / 7), _
                                $iDayNum = Mod($iDayForPregnant, 7), _
                                $iDayTotal = $iDayForPregnant
                GUICtrlSetData($Input4, $iWeekNum)
                GUICtrlSetData($Input5, $iDayNum)
                GUICtrlSetData($Input6, $iDayTotal)
        Else
                GUICtrlSetData($Input4, '')
                GUICtrlSetData($Input5, '')
                GUICtrlSetData($Input6, '')
        EndIf
EndFunc   ;==>_Show_DayForPregnant

Func _Show_DayToBirth($iDayToBirth, $iMode = 1)
        If $iMode == 1 Then
                Local $iMonthNum = Floor($iDayToBirth / 30), _
                                $iDayNum = Mod($iDayToBirth, 30), _
                                $iDayTotal = $iDayToBirth
                If $iDayTotal > 9999 Then
                        $iMonthNum = '???'
                        $iDayNum = '??'
                        $iDayTotal = '????'
                EndIf
                GUICtrlSetData($Input7, $iMonthNum)
                GUICtrlSetData($Input8, $iDayNum)
                GUICtrlSetData($Input9, $iDayTotal)
                ;
                Local $iWeekNum = Floor($iDayToBirth / 7), _
                                $iDayNum = Mod($iDayToBirth, 7), _
                                $iDayTotal = $iDayToBirth
                If $iWeekNum > 999 Then
                        $iWeekNum = '???'
                        $iDayNum = '??'
                        $iDayTotal = '????'
                EndIf
                GUICtrlSetData($Input10, $iWeekNum)
                GUICtrlSetData($Input11, $iDayNum)
                GUICtrlSetData($Input12, $iDayTotal)
        Else
                GUICtrlSetData($Input7, '')
                GUICtrlSetData($Input8, '')
                GUICtrlSetData($Input9, '')
                GUICtrlSetData($Input10, '')
                GUICtrlSetData($Input11, '')
                GUICtrlSetData($Input12, '')
        EndIf
EndFunc   ;==>_Show_DayToBirth

Func _Write($sFile, $sSection, $sKey, $dPregnantDate)
        ;处理怀孕日期,获取 年 月 日, 给 月 日 的一位数字补0 (如 09月 09日)
        Local $t = StringSplit($dPregnantDate, '-')
        Local $iYear = $t[1], _
                        $iMonth = $t[2], _
                        $iDay = $t[3]
        $dPregnantDate = $iYear & '-' & StringRight('0' & $iMonth, 2) & '-' & StringRight('0' & $iDay, 2)

        ;写入配置文件
        IniWrite($sFile, $sSection, $sKey, $dPregnantDate)

EndFunc   ;==>_Write

Func _LoadSkin($sSkinFile, $sSkinDll, $cForm)
        Local $hSkinDll = DllOpen($sSkinDll)
        DllCall($hSkinDll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
        DllCall($hSkinDll, "int:cdecl", "InitDecoration", "int", 1)
        DllCall($hSkinDll, "int:cdecl", "LoadSkinFromFile", "wstr", $sSkinFile)
        DllCall($hSkinDll, "int:cdecl", "DecorateAs", "int", $cForm, "int", 25)
        DllCall($hSkinDll, "int:cdecl", "ApplySkin")
        Return $hSkinDll
EndFunc   ;==>_LoadSkin

Func _UnLoadSkin($hSkinDll)
        GUISetState(@SW_HIDE)
        DllCall($hSkinDll, "int:cdecl", "DeInitDecoration")
        DllCall($hSkinDll, "int:cdecl", "RemoveSkin")
        DllClose($hSkinDll)
EndFunc   ;==>_UnLoadSkin
 楼主| 发表于 2009-9-27 15:44:44 | 显示全部楼层
本帖最后由 smooth 于 2009-9-27 15:46 编辑

你改了之后,点击管关闭按钮无法关闭程序,在任务栏上点击右键,选择关闭也无法关闭程序(也即ALT+F4),只能通过通知区域的程序图标点击右键,选择退出,才能关闭程序。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-4 15:28 , Processed in 0.073827 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表