找回密码
 加入
搜索
查看: 7070|回复: 12

[系统综合] 求 设置开机启动工具 源码

 火.. [复制链接]
发表于 2010-7-28 22:50:57 | 显示全部楼层 |阅读模式
悬赏50金钱已解决
本帖最后由 cjhhuanshao 于 2010-7-30 19:25 编辑

论坛的开机启动设置工具功能太多了,我想要 设置 开/关机 两个小功能 就行了。 指定一个程序 不用自己动手添加上去。在这里先谢谢了!

最佳答案

查看完整内容

#include #include #include #include $Form1 = GUICreate("xx", 250, 240, -1, -1) FileInstall("top.bmp", @TempDir & "\top.bmp") $Pic1 = GUICtrlCreatePic(@TempDir & "\top.bmp", 0, 0, 249, 73) FileDelete(@TempDir & "\top.bmp") $Group1 = GUICtrlCreateGroup("xx 设置", 0, 80, 250, 81) $Button1 = GUICtrlCreateButton("开机启动", 16, 100, 99, 49) $Button2 = GUICtrlCreateButton("取消开机启动", 144, 100, ...
发表于 2010-7-28 22:50:58 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("xx", 250, 240, -1, -1)
FileInstall("top.bmp", @TempDir & "\top.bmp")
$Pic1 = GUICtrlCreatePic(@TempDir & "\top.bmp", 0, 0, 249, 73)
FileDelete(@TempDir & "\top.bmp")
$Group1 = GUICtrlCreateGroup("xx 设置", 0, 80, 250, 81)
$Button1 = GUICtrlCreateButton("开机启动", 16, 100, 99, 49)
$Button2 = GUICtrlCreateButton("取消开机启动", 144, 100, 91, 49)
$Label1 = GUICtrlCreateLabel("今天您xx?", 16, 176)
$Label2 = GUICtrlCreateLabel("请支持xx www.xxx.cn", 16, 200)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button1
                        FileCreateShortcut(@ScriptDir & "\xx.exe", @StartupDir & "\xx.lnk")
                        MsgBox(0, "", "ok")

                Case $Button2
                        If FileExists(@StartupDir & "\xx.lnk") Then FileDelete(@StartupDir & "\xx.lnk")
                        MsgBox(0, "", "ok")
                       
                Case $Label2
                        Run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE www.xxx.cn")

        EndSwitch
WEnd
 楼主| 发表于 2010-7-29 09:32:43 | 显示全部楼层
本帖最后由 cjhhuanshao 于 2010-7-29 10:57 编辑

回复 2# lindafu

谢谢了楼上的兄弟。辛苦你了!
发表于 2010-7-29 09:59:07 | 显示全部楼层
;我也来凑凑热闹
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("开机启动设置工具", 600, 100, -1, -1)
$Input1 = GUICtrlCreateInput("C:\WINDOWS\system32\cmd.exe /k ipconfig /all", 24, 24, 509, 21)
$Button1 = GUICtrlCreateButton("浏览", 540, 24, 50, 21)
$Button2 = GUICtrlCreateButton("设置启动运行", 100, 60, 100, 25)
$Button3 = GUICtrlCreateButton("取消启动运行", 250, 60, 100, 25)
$Button4 = GUICtrlCreateButton("退出", 400, 60, 60, 25)
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                case $Button4
                        exit
                case $Button1
$var = FileOpenDialog("选择启动运行的程序", "", "可执行文件(*.exe;*.cmd;*.bat;*.vbs)")
If @error Then
Else
GUICtrlSetData($Input1,$var)
EndIf
                case $Button2
                        $run1 = GUICtrlRead($Input1)
                        $run2 = StringTrimLeft($run1,StringInStr($run1, "",0,-1))
                        $run3 = StringLeft($run2,StringInStr($run2, ".",0,-1)-1)
                        if RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3) = $run1 then
                        msgbox(48,"错误","此启动项已经存在,请勿重复设置!",3)
                        else
                        RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3, "REG_SZ", $run1)
                        if RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3) <> $run1 then msgbox(16,"失败","添加启动项失败!请检查用户和注册表权限!",3)
                        endif
                case $Button3
                        $run1 = GUICtrlRead($Input1)
                        $run2 = StringTrimLeft($run1,StringInStr($run1, "",0,-1))
                        $run3 = StringLeft($run2,StringInStr($run2, ".",0,-1)-1)
                        if RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3) = $run1 then
                        RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3)
                        if RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$run3) = $run1 then msgbox(16,"失败","删除启动项失败!请检查用户和注册表权限!",3)
                        else
                        msgbox(48,"错误","此启动项不存在!")
                        endif
        EndSwitch
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2010-7-29 10:59:08 | 显示全部楼层
回复 4# xsjtxy
2楼就是我想要的结果。。谢谢你了!你也辛苦了!
 楼主| 发表于 2010-7-29 14:10:32 | 显示全部楼层
回复 2# lindafu
兄弟 再麻烦你一下 刚才测试一下 设置 启动 查看 起始位置空白的...设置了开机启动。开机出错问题的.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-7-29 14:24:17 | 显示全部楼层
FileCreateShortcut(@ScriptDir & "\xx.exe", @StartupDir & "\xx.lnk", @ScriptDir)
 楼主| 发表于 2010-7-29 14:32:50 | 显示全部楼层
回复 7# lindafu
谢谢了 哈!!
发表于 2010-7-29 22:08:24 | 显示全部楼层
啊 学习了  哈哈
发表于 2010-7-30 09:05:32 | 显示全部楼层
真搞不懂这个东西的意义在哪
发表于 2011-8-14 22:11:41 | 显示全部楼层
学习。。。。。。。。。。。。
发表于 2011-9-7 16:52:35 | 显示全部楼层
谢谢2楼!~~~~
发表于 2011-9-8 19:28:10 | 显示全部楼层
回复 4# xsjtxy

学习了,看上去还不错!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 10:30 , Processed in 0.089098 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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