找回密码
 加入
搜索
查看: 1833|回复: 4

关于写入注册表

[复制链接]
发表于 2008-10-18 18:05:46 | 显示全部楼层 |阅读模式
我想把QQ信息写入注册表中,但遇到一些不会弄的,希望大家帮一下忙

如图,填写信息后,点击确定就写入注册表中(未填写,点击确定无数据写入),删除这项就不用帮我写了

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Process.au3>

$Form1 = GUICreate("QQ设置", 243, 268, 190, 120)
$tab=GUICtrlCreateTab (10,230, 220,26)
GUISetFont(12, 200)
GUISetBkColor(0xcccffc);设置窗体颜色
$tab=GUICtrlCreateTab (18,460, 363,26)
GUISetBkColor(0xEDB078)

$tab0=GUICtrlCreateTabitem ("QQ1")
GUICtrlCreateInput("", 64, 16, 153, 21)
GUICtrlCreateInput("", 64, 56, 153, 21)
GUICtrlCreateInput("", 64, 96, 153, 21)
GUICtrlCreateLabel("QQ路径", 24, 24, 36, 17)
GUICtrlCreateLabel("QQ号码", 24, 64, 36, 17)
GUICtrlCreateLabel("QQ密码", 24, 104, 36, 17)
GUICtrlCreateRadio("隐身", 72, 144, 57, 17)
$Radio2 = GUICtrlCreateRadio("在线", 152, 144, 65, 17)
$Button1 = GUICtrlCreateButton("确定", 48, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("删除", 136, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)

$tab1=GUICtrlCreateTabitem ("QQ2")
GUICtrlCreateInput("", 64, 16, 153, 21)
GUICtrlCreateInput("", 64, 56, 153, 21)
GUICtrlCreateInput("", 64, 96, 153, 21)
GUICtrlCreateLabel("QQ路径", 24, 24, 36, 17)
GUICtrlCreateLabel("QQ号码", 24, 64, 36, 17)
GUICtrlCreateLabel("QQ密码", 24, 104, 36, 17)
GUICtrlCreateRadio("隐身", 72, 144, 57, 17)
$Radio2 = GUICtrlCreateRadio("在线", 152, 144, 65, 17)
$Button1 = GUICtrlCreateButton("确定", 48, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("删除", 136, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

注册表数据:
QQ路径:RegWrite("HKCU\Software\Microsoft\General", "l", "REG_SZ", "c:\qq2008\qq.exe")
QQ号:RegWrite("HKCU\Software\Microsoft\General", "h", "REG_SZ", "45154763")
QQ密码:RegWrite("HKCU\Software\Microsoft\General", "m", "REG_SZ", "123456")
隐身或在线:RegWrite("HKCU\Software\Microsoft\General", "z", "REG_SZ", "40");或41

[ 本帖最后由 botanycc 于 2008-10-21 12:16 编辑 ]

本帖子中包含更多资源

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

×
发表于 2008-10-18 18:25:53 | 显示全部楼层
case buuton1
 楼主| 发表于 2008-10-18 19:13:26 | 显示全部楼层
$i = GUICtrlCreateInput("", 64, 16, 153, 21)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
Case $Button1
RegWrite("HKCU\Software\Microsoft\Windows\General", "l", "REG_SZ", $i)
        EndSwitch
WEnd

写入不成功

[ 本帖最后由 botanycc 于 2008-10-18 21:32 编辑 ]
发表于 2008-10-18 23:07:38 | 显示全部楼层
刚刚试了一下
你的GUI的问题

有两个TAB  但是控件名重复

你是不是在TAB0下按确定没有写入成功
换到TAB1下可以成功
发表于 2008-10-20 12:36:28 | 显示全部楼层

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Process.au3>

$Form1 = GUICreate("QQ设置", 243, 268, 190, 120)
$tab=GUICtrlCreateTab (10,230, 220,19)
GUISetFont(12, 200)
GUISetBkColor(0xcccffc);设置窗体颜色
GUICtrlCreateTab (18,460, 363,26)
GUISetBkColor(0xEDB078)

GUICtrlCreateTabitem ("QQ1")
$input1 = GUICtrlCreateInput(RegRead("HKCU\Software\Microsoft\General", "l"), 64, 16, 153, 21)
GUICtrlSetState(-1,$GUI_FOCUS)
$input2 = GUICtrlCreateInput(RegDelete("HKCU\Software\Microsoft\General", "h"), 64, 56, 153, 21)
$input3 = GUICtrlCreateInput(RegDelete("HKCU\Software\Microsoft\General", "m"), 64, 96, 153, 21)
GUICtrlCreateLabel("QQ路径", 13, 18, 50, 17)
GUICtrlCreateLabel("QQ号码", 13, 58, 50, 17)
GUICtrlCreateLabel("QQ密码", 13, 98, 50, 17)
$Radio1 = GUICtrlCreateRadio("隐身", 72, 144, 57, 17)
GUICtrlCreateRadio("在线", 152, 144, 65, 17)
$Button5 = GUICtrlCreateButton("B", 218, 16, 24, 20)
GUICtrlSetCursor (-1, 0)
$Button1 = GUICtrlCreateButton("确定", 48, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("删除", 136, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)

GUICtrlCreateTabitem ("QQ2")
$input4 = GUICtrlCreateInput(RegDelete("HKCU\Software\Microsoft\General", "l2"), 64, 16, 153, 21)
$input5 = GUICtrlCreateInput(RegDelete("HKCU\Software\Microsoft\General", "h2"), 64, 56, 153, 21)
$input6 = GUICtrlCreateInput(RegDelete("HKCU\Software\Microsoft\General", "m2"), 64, 96, 153, 21)
GUICtrlCreateLabel("QQ路径", 13, 18, 50, 17)
GUICtrlCreateLabel("QQ号码", 13, 58, 50, 17)
GUICtrlCreateLabel("QQ密码", 13, 98, 50, 17)
$Radio2 = GUICtrlCreateRadio("隐身", 72, 144, 57, 17)
GUICtrlCreateRadio("在线", 152, 144, 65, 17)
$Button6 = GUICtrlCreateButton("B", 218, 16, 24, 20)
GUICtrlSetCursor (-1, 0)
$Button3 = GUICtrlCreateButton("写入", 48, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button4 = GUICtrlCreateButton("删除", 136, 176, 59, 25, 0)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                        
                Case $Button1
                        If GUICtrlRead($Radio1) = $GUI_CHECKED Then
                                $QQ1 = 40
                        Else
                                $QQ1 = 41
                        EndIf
                        RegWrite("HKCU\Software\Microsoft\General", "l", "REG_SZ", GUICtrlRead($input1))
                        RegWrite("HKCU\Software\Microsoft\General", "h", "REG_SZ", GUICtrlRead($input2))
                        RegWrite("HKCU\Software\Microsoft\General", "m", "REG_SZ", GUICtrlRead($input3))
                        RegWrite("HKCU\Software\Microsoft\General", "z", "REG_SZ", $QQ1)
                        
                Case $Button2
                        RegDelete("HKCU\Software\Microsoft\General", "l")
                        RegDelete("HKCU\Software\Microsoft\General", "h")
                        RegDelete("HKCU\Software\Microsoft\General", "m")
                        RegDelete("HKCU\Software\Microsoft\General", "z")
                        
                Case $Button3
                        If GUICtrlRead($Radio1) = $GUI_CHECKED Then
                                $QQ2 = 40
                        Else
                                $QQ2 = 41
                        EndIf
                        RegWrite("HKCU\Software\Microsoft\General", "l2", "REG_SZ", GUICtrlRead($input4))
                        RegWrite("HKCU\Software\Microsoft\General", "h2", "REG_SZ", GUICtrlRead($input5))
                        RegWrite("HKCU\Software\Microsoft\General", "m2", "REG_SZ", GUICtrlRead($input6))
                        RegWrite("HKCU\Software\Microsoft\General", "z2", "REG_SZ", $QQ2)
                        
                Case $Button4
                        RegDelete("HKCU\Software\Microsoft\General", "l2")
                        RegDelete("HKCU\Software\Microsoft\General", "h2")
                        RegDelete("HKCU\Software\Microsoft\General", "m2")
                        RegDelete("HKCU\Software\Microsoft\General", "z2")
                        
                Case $Button5
                        $B1 = FileOpenDialog('选择', '', 'QQ程序(*.EXE)', '', 'QQ.EXE')
                        GUICtrlSetData($input1, $B1, '')
                        
                Case $Button6
                        $B2 = FileOpenDialog('选择', '', 'QQ程序(*.EXE)', '', 'QQ.EXE')
                        GUICtrlSetData($input1, $B2, '')
                        
                        
        EndSwitch
WEnd

;~ 注册表数据:
;~ QQ路径:RegWrite("HKCU\Software\Microsoft\General", "l", "REG_SZ", "c:\qq2008\qq.exe")
;~ QQ号:RegWrite("HKCU\Software\Microsoft\General", "h", "REG_SZ", "45154763")
;~ QQ密码:RegWrite("HKCU\Software\Microsoft\General", "m", "REG_SZ", "123456")
;~ 隐身或在线:RegWrite("HKCU\Software\Microsoft\General", "z", "REG_SZ", "40")或41
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-11 20:47 , Processed in 0.071507 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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