#include <GUIConstants.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <array.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <array.au3>
#include <GUIConstants.au3>
#include <GuiIPAddress.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 226, 133)
$Button1 = GUICtrlCreateButton("OEM信息设置", 8, 48, 99, 33, 0)
$Button2 = GUICtrlCreateButton("驱动路径设置", 120, 48, 99, 33, 0)
$Button3 = GUICtrlCreateButton("修改IP地址", 8, 88, 99, 33, 0)
$Button4 = GUICtrlCreateButton("分辨率设置", 120, 88, 99, 33, 0)
$Button5 = GUICtrlCreateButton("系统自动登陆", 64, 8, 99, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IniWrite(@SystemDir & "\oeminfo.ini", "Support Information", "", "")
GUICreate("OEM信息修改器", 383, 496)
GUICtrlCreateGroup("", 5, 1, 371, 487)
GUICtrlCreateLabel("注册名称", 176, 16, 52, 17)
$oemwink1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner")
$oemInput = GUICtrlCreateInput("", 202, 38, 145, 21)
GUICtrlSetData($oemInput, ($oemwink1))
$oemwink2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization")
$oemInput2 = GUICtrlCreateInput("", 202, 66, 145, 21)
GUICtrlSetData($oemInput2, ($oemwink2))
$oemwink3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId")
$oemInput3 = GUICtrlCreateInput("", 202, 94, 145, 21)
GUICtrlSetData($oemInput3, ($oemwink3))
$oemwink4 = IniRead(@SystemDir & "\OemInfo.ini", "General", "Manufacturer", "")
GUICtrlCreateLabel("制作商和技术支持商", 176, 120, 112, 17)
$oemInput4 = GUICtrlCreateInput("", 202, 139, 145, 21)
GUICtrlSetData($oemInput4, ($oemwink4))
$oemwink5 = IniRead(@SystemDir & "\OemInfo.ini", "General", "Model", "")
$oemInput5 = GUICtrlCreateInput("", 202, 164, 145, 21)
GUICtrlSetData($oemInput5, ($oemwink5))
$oemInput6 = GUICtrlCreateEdit("", 10, 208, 361, 231, $ES_WANTRETURN)
$wink6 = IniReadSection(@SystemDir & "\oeminfo.ini", "Support Information")
For $i = 1 To $wink6[0][0]
GUICtrlSetData($oemInput6, $wink6[$i][1]&@CRLF,"1")
Next
GUICtrlCreateLabel("OEM图片", 16, 16, 52, 17)
$oempic = FileGetShortName(@SystemDir & "\OemLogo.bmp")
GUICtrlCreatePic($oempic, 15, 39, 145, 115)
$openoem = GUICtrlCreateButton("查看OEM", 10, 162, 70, 20)
$openpic = GUICtrlCreateButton("自定义图片", 85, 162, 80, 20)
$oemButton1 = GUICtrlCreateButton("删除OEM信息",113, 449, 80, 25)
$oemButton2 = GUICtrlCreateButton("确 定",198, 449, 80, 25)
$oemButton3 = GUICtrlCreateButton("关 闭",283, 449, 80, 25)
GUISetState(@SW_SHOW)
While 1
$nmsg = GUIGEtMsg()
Select
Case $nmsg = $GUI_EVENT_CLOSE
ExitLoop
Case $nmsg = $openpic
$message = "打开你所选的*.bmp格式"
$SFile = FileOpenDialog($message, @DesktopCommonDir & "", "不大于118X115的位图文件(*.bmp)", 1)
IF $SFile Then
GUICtrlCreatePic($SFile, 15, 39, 145, 115)
Sleep(500)
$ok2oempic = GUICtrlCreatePic($SFile, 15, 39, 145, 115)
EndIf
Case $nmsg = $openoem
Run("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl ")
Case $nmsg = $oemButton1
FileDelete(@SystemDir & "\OemInfo.ini")
FileDelete(@SystemDir & "\OemLogo.bmp")
MsgBox(64, "", "已经删除了OEM信息!")
$oemwink1=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","RegisteredOrganization")
$oemwink2=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","RegisteredOwner")
$oemwink3=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductId")
$oemwink4 = IniRead(@SystemDir & "\OemInfo.ini", "General", "Manufacturer", "")
$oemwink5 = IniRead(@SystemDir & "\OemInfo.ini", "General", "Model", "")
$wink6 = IniReadSection(@SystemDir & "\oeminfo.ini", "Support Information")
Case $nmsg = $oemButton2
$oemokInput = GUICtrlRead ($oemInput)
$oemokInput2 = GUICtrlRead ($oemInput2)
$oemokInput3 = GUICtrlRead ($oemInput3)
$oemokInput4 = GUICtrlRead ($oemInput4)
$oemokInput5 = GUICtrlRead ($oemInput5)
$oemokInput6 = GUICtrlRead ($oemInput6)
$t = StringSplit($oemokinput6, @LF)
$sIni = @SystemDir & "\oeminfo.ini"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", "REG_SZ", $oemokInput)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", $oemokInput2)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", "REG_SZ", $oemokInput3)
IniWrite(@SystemDir & "\OemInfo.ini", "General", "Manufacturer",$oemokInput4)
IniWrite(@SystemDir & "\OemInfo.ini", "General", "Model",$oemokInput5)
For $i = 1 To UBound($t) - 1
$t[$i] = 'Line' & $i & '=' & $t[$i]
Next
IniWriteSection(@SystemDir & "\OemInfo.ini", "Support Information", _ArrayToString($t, @LF, 1))
FileCopy(@SystemDir & "\OemLogo.bmp", 1)
MsgBox(64, "", "OEM设置完毕,请点击 查看OEM")
Case $nmsg = $oemButton3
Exit
EndSelect
WEnd
Case $Button2
$old_reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath")
$s_Path1 = "C:\" ;预定义根目录
#Region ### START Koda GUI section ### Form=d:\me\support\桌面\b b\aform1.kxf
$AForm1_1 = GUICreate("自由天空设置驱动包搜索路径工具", 546, 394, 314, 169, -1, 0)
$Group1 = GUICtrlCreateGroup("添加驱动路径", 232, 8, 297, 305)
$Input1 = GUICtrlCreateInput("未选择目录", 240, 32, 201, 21,$ES_READONLY)
GUICtrlSetBkColor (-1, 0xFFFF80)
$Edit1 = GUICtrlCreateEdit($old_reg, 24, 32, 185, 273,BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$ES_READONLY))
GUICtrlSetBkColor (-1, 0xFFFF80)
$Edit2 = GUICtrlCreateEdit("", 240, 72, 201, 233,BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$ES_READONLY))
GUICtrlSetBkColor (-1, 0xFFFF80)
$xzml = GUICtrlCreateButton("选择目录", 448, 32, 75, 25, 0)
$yl = GUICtrlCreateButton("预浏览", 448, 72, 75, 25, 0)
GUICtrlSetState($yl, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("目前驱动路径", 16, 8, 201, 305)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$mssz = GUICtrlCreateButton("马上设置", 16, 328, 155, 49, 0)
GUICtrlSetState($mssz, $GUI_DISABLE)
$hfyz = GUICtrlCreateButton("恢复原值", 192, 328, 155, 49, 0)
GUICtrlSetState($hfyz, $GUI_DISABLE)
$hyxpmrz = GUICtrlCreateButton("还原XP默认值", 368, 328, 155, 49, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nmsg = GuiGetMsg() ;捕获窗体事件
Select
Case $nmsg=$GUI_EVENT_CLOSE ;如果用户点击关闭按钮就退出程序
Exit
Case $nmsg = $xzml
$Path1 = FileSelectFolder("选择驱动集目录", "", "",$s_Path1)
$Path2 = $Path1
If Not @error Then
If StringRight($Path1, 1) = "\" Then ;判断是否为根目录
GuiCtrlSetData($Input1, $Path1 & "*.*") ;是
Else
GuiCtrlSetData($Input1, $Path1 & "\*.*") ;否
endif
GUICtrlSetState($yl, $GUI_ENABLE)
endif
Case $nmsg = $yl
DevicePath($Path1,$Path2) ;调用DevicePath函数,获取驱动目录列表。
If StringRight($Path1, 1) = "\" Then $Path2 = StringReplace ($Path2,"\\","\") ;如果选择的目录是根目录,就将"\\"改为"\"。
GUICtrlSetData($Edit2, $Path2,"")
GUICtrlSetState($mssz, $GUI_ENABLE)
Case $nmsg = $mssz
$new_reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath")
RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","DevicePath", "REG_EXPAND_SZ", $new_reg & ";" & $Path2)
GUICtrlSetState($hfyz, $GUI_ENABLE)
GuiCtrlSetData($Input1, "未选择目录")
GUICtrlSetState($yl, $GUI_DISABLE)
GUICtrlSetData($Edit2, "")
GUICtrlSetState($mssz, $GUI_DISABLE)
GUICtrlSetData($Edit1,RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath"))
Case $nmsg = $hfyz
RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","DevicePath", "REG_EXPAND_SZ", $old_reg)
GuiCtrlSetData($Input1, "未选择目录")
GuiCtrlSetData($Edit1, $old_reg)
GUICtrlSetState($mssz, $GUI_DISABLE)
GUICtrlSetState($yl, $GUI_DISABLE)
GUICtrlSetData($Edit2, "")
GUICtrlSetState($hfyz, $GUI_DISABLE)
Case $nmsg = $hyxpmrz
RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","DevicePath", "REG_EXPAND_SZ", "%SystemRoot%\inf")
GuiCtrlSetData($Input1, "未选择目录")
GUICtrlSetData($Edit1,RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath"))
GUICtrlSetData($Edit2,"")
GUICtrlSetState($yl, $GUI_DISABLE)
GUICtrlSetState($mssz, $GUI_DISABLE)
Case Else
ContinueLoop
EndSelect
WEnd
Func DevicePath($Dir1,ByRef $Dir2) ;定义$dir1为值传递参数,$dir2为引用参数
If StringRight($Dir1, 4) <> "\*.*" Then
$search = FileFindFirstFile($Dir1 & "\*.*")
Else
$search = FileFindFirstFile($Dir1)
EndIf
While 1
$file = FileFindNextFile($search )
If @error Then ExitLoop
If FileGetAttrib ($Dir1 & "\" & $file)="D" Then ;判断找到的是否目录。
$Dir2 = $Dir2 & ";" & $Dir1 & "\" & $file ;将找到的目录名增加到变量中。
DevicePath($Dir1 & "\" & $file,$Dir2);递归搜索
EndIf
WEnd
FileClose($search);; 关闭搜索句柄
EndFunc
Case $Button3
$g_szVersion = "ip"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For $objItem In $colItems
$LocalGateway= $objItem.DefaultIPGateway(0)
$LoaclHostName=$objItem.DNSHostName
$LocalIP=$objItem.IPAddress(0)
$LocalDns1= $objItem.DNSServerSearchOrder(0)
$LocalDns2= $objItem.DNSServerSearchOrder(1)
$LocalSubnetmask= $objItem.IPSubnet(0)
$b=$objItem.Description
Next
Local $index = 3
$hgui = GUICreate("IP 地址修改器 v1.0", 250, 300)
GUICtrlCreateGroup ("", 0, 0, 250, 35)
;GUICtrlSetColor(-1,0xff0000)
GUICtrlCreateLabel("计算机名:", 10, 15,60,15)
GUICtrlSetColor(-1,0x0000ff)
$computername = GUICtrlCreateInput($LoaclHostName,70, 10, 125,20)
GUICtrlCreateGroup ("",-99,-99,1,1)
GUICtrlCreateGroup ("", 0, 35, 250, 220)
GUICtrlCreateLabel("I P 地址:", 10, 60,60,15)
GUICtrlSetColor(-1,0x0000ff)
$IPAddress= _GUICtrlIpAddressCreate ($hgui, 70, 50, 125, 30,$WS_CHILD)
_GUICtrlIpAddressSet ($IPAddress,$LocalIP)
_GUICtrlIpAddressSetFocus ($IPAddress,$index)
GUICtrlCreateLabel("子网掩码:", 10, 100,60,15)
GUICtrlSetColor(-1,0x0000ff)
$Subnetmask = _GUICtrlIpAddressCreate ($hgui, 70, 90, 125, 30,$WS_CHILD)
_GUICtrlIpAddressSet ($Subnetmask, $LocalSubnetmask)
GUICtrlCreateLabel("默认网关:", 10, 140,60,15)
GUICtrlSetColor(-1,0x0000ff)
$Gateway = _GUICtrlIpAddressCreate ($hgui, 70, 130, 125, 30,$WS_CHILD)
_GUICtrlIpAddressSet ($Gateway, $LocalGateway)
GUICtrlSetState($Gateway,$GUI_DISABLE)
GUICtrlCreateLabel("首选DNS:", 10, 180,60,15)
GUICtrlSetColor(-1,0x0000ff)
$Dns1 = _GUICtrlIpAddressCreate ($hgui, 70, 170, 125, 30, $WS_CHILD)
_GUICtrlIpAddressSet ($Dns1,$LocalDns1)
GUICtrlCreateLabel("备用DNS:", 10, 220,60,15)
GUICtrlSetColor(-1,0x0000ff)
$Dns2 = _GUICtrlIpAddressCreate ($hgui, 70, 210, 125, 30, $WS_CHILD)
_GUICtrlIpAddressSet ($Dns2,$LocalDns2)
GUICtrlCreateGroup ("",-99,-99,1,1)
$readbutton = GUICtrlCreateButton("自动修改", 10, 260, 100, 25)
$setbutton = GUICtrlCreateButton("修改设置", 130, 260, 100, 25)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $readbutton
;MsgBox(0,"slkdjf",$b)
_SetIpEditState(0)
Dim $SetIPAddress[1]
$SetIPAddress[0] = _GUICtrlIpAddressGet ($IPAddress)
Dim $SetSubnetmask[1]
$SetSubnetmask[0] = _GUICtrlIpAddressGet ($Subnetmask)
Dim $SetGateway[1]
$SetGateway[0] = _GUICtrlIpAddressGet ($Gateway)
Dim $SetDns[2]
$SetDns[0]=_GUICtrlIpAddressGet ($Dns1)
$SetDns[1]=_GUICtrlIpAddressGet ($Dns2)
$Setcomputername = GUICtrlRead($computername)
MsgBox(64,"Information ",$Setcomputername&@CRLF& $SetIPAddress[0] _
&@CRLF& $SetSubnetmask[0]&@CRLF&$SetGateway[0] &@CRLF&$SetDns[0]&@CRLF&$SetDns[1])
_SetIpEditState(1)
Case $msg = $setbutton
_SetIpEditState(0)
Dim $SetIPAddress[1]
$SetIPAddress[0] = _GUICtrlIpAddressGet ($IPAddress)
Dim $SetSubnetmask[1]
$SetSubnetmask[0] = _GUICtrlIpAddressGet ($Subnetmask)
Dim $SetGateway[1]
$SetGateway[0] = _GUICtrlIpAddressGet ($Gateway)
Dim $SetDns[2]
$SetDns[0]=_GUICtrlIpAddressGet ($Dns1)
$SetDns[1]=_GUICtrlIpAddressGet ($Dns2)
$Setcomputername = GUICtrlRead($computername)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For $objNetAdapter in $colComputers
$objNetAdapter.Rename($Setcomputername)
Next
If IsObj($colItems) Then
For $objNetAdapter in $colItems
$objNetAdapter.EnableStatic($SetIPAddress,$SetSubnetmask)
$objNetAdapter.SetGateways($SetGateway)
$objNetAdapter.SetDNSServerSearchOrder($SetDns)
Next
MsgBox(64,"Information ",$Setcomputername&@CRLF& $SetIPAddress[0] _
&@CRLF& $SetSubnetmask[0]&@CRLF&$SetGateway[0] &@CRLF&$SetDns)
EndIf
_SetIpEditState(1)
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func _SetIpEditState($s=1)
For $i=2 To 21
If $s=0 Then
GUICtrlSetState($computername, $GUI_DISABLE)
ControlDisable("","","Edit" & $i)
Else
GUICtrlSetState($computername, $GUI_ENABLE)
ControlEnable("","","Edit"& $i)
EndIf
Next
EndFunc
Case $Button4
Const $n = 10
Dim $choose[$n]
$title = GUICreate("设置屏幕分辨率程序", 360, 170)
$Group = GUICtrlCreateGroup("", 5, 5, 350, 155)
$group1 = GUICtrlCreateGroup("CRT显示器", 10, 15, 110, 90)
$group2 = GUICtrlCreateGroup("LCD显示器", 125, 15, 110, 90)
$group3 = GUICtrlCreateGroup("宽屏显示器", 240, 15, 110, 90)
$choose[1] = GUICtrlCreateRadio("800*600*32*75", 12, 35, 105, 20)
$choose[2] = GUICtrlCreateRadio("1024*768*32*75", 12, 55, 105, 20)
$choose[3] = GUICtrlCreateRadio("1280*1024*32*75", 12, 75, 105, 20)
$choose[4] = GUICtrlCreateRadio("1024*768*32*70", 127, 35, 105, 20)
$choose[5] = GUICtrlCreateRadio("1024*768*32*60", 127, 55, 105, 20)
$choose[6] = GUICtrlCreateRadio("1280*1024*32*60", 127, 75, 105, 20)
$choose[7] = GUICtrlCreateRadio("1280*720*32*60", 242, 35, 105, 20)
$choose[8] = GUICtrlCreateRadio("1440*900*32*60", 242, 55, 105, 20)
$choose[9] = GUICtrlCreateRadio("1680*1050*32*60", 242, 75, 105, 20)
$Label=GUICtrlCreateLabel(" 分辨率设置过高可能会造成黑屏,按下CTRL+R可快速降低分辨率", 10, 115)
$LabelColor=GUICtrlSetColor(-1, 0xff0000)
$HotKey=HotKeySet("^r", "DefaultChangeScreenRes")
$Button1 = GUICtrlCreateButton("确定(&W)", 220, 135, 60, 20)
$Button2 = GUICtrlCreateButton("退出(&E)", 290, 135,60, 20)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Button2
ExitLoop
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[1]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$1 = _ChangeScreenRes(800, 600, 32, 75)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[2]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$2 = _ChangeScreenRes(1024, 768, 32, 75)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[3]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$3 = _ChangeScreenRes(1280, 1024, 32, 75)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[4]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$4 = _ChangeScreenRes(1024, 768, 32, 70)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[5]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$5 = _ChangeScreenRes(1024, 768, 32, 60)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[6]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$6 = _ChangeScreenRes(1280, 1024, 32, 60)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[7]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$7 = _ChangeScreenRes(1280, 720, 32, 60)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[8]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$8 = _ChangeScreenRes(1440, 900, 32, 60)
Case $nMsg = $Button1 And BitAND(GUICtrlRead($choose[9]), $GUI_CHECKED) = $GUI_CHECKED ;BitAND为按位"与"运算
$9 = _ChangeScreenRes(1680, 1050, 32, 60)
EndSelect
WEnd
Func DefaultChangeScreenRes()
_ChangeScreenRes(800, 600, 16, 60)
EndFunc ;==>DefaultChangeScreenRes
Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $DISP_CHANGE_RESTART = 1
Local Const $DISP_CHANGE_SUCCESSFUL = 0
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting
If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting
If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting
If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting
Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]")
Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE))
If @error Then
$B = 0
SetError(1)
Return $B
Else
$B = $B[0]
EndIf
If $B <> 0 Then
DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
DllStructSetData($DEVMODE, 4, $i_Width, 2)
DllStructSetData($DEVMODE, 4, $i_Height, 3)
DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
$B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST)
If @error Then
$B = -1
Else
$B = $B[0]
EndIf
Select
Case $B = $DISP_CHANGE_RESTART
$DEVMODE = ""
Return 2
Case $B = $DISP_CHANGE_SUCCESSFUL
DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
"int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
$DEVMODE = ""
Return 1
Case Else
$DEVMODE = ""
SetError(1)
Return $B
EndSelect
EndIf
EndFunc
Case $Button5
$welcom = msgbox (4,"windows自动登陆设置工具","本向导将引导您设置自动登陆")
if $welcom=6 then ;=>是
begin() ;=>自定义涵数
Else
Exit
endif
Func begin()
$box = regread ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName") ;=======>读注册表值
$name = inputbox ("自动登设置","请输入您要自动登陆的用户名",$box,"",200,100) ;=====>输入框在默认文本里显示上一行读到的值
$pass = inputbox ("自动登设置","请输入您要自动登陆的用户密码","","*",200,100) ;===>转入框字符以*号代替
if $name <> "" and $pass <> "" Then ;=======>如果$name 和$pass 都不等于空
$rady=MsgBox(4 , "自动登陆设置", "所有的输入都正确吗?")
if $rady=6 Then
regwrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName","reg_sz",$name) ;====>把前面输入的值写入注册表
regwrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultPassWord","reg_sz",$pass) ;====>把前面输入的值写入注册表
regwrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon","AutoAdminLogon","reg_sz","1") ;====>新建一个键值
$exit =msgbox (4,"恭喜你!","所有的设置都很成功重启之后就能生效了确定要重启系统吗?")
if $exit = 6 Then
shutdown (6)
elseif $exit = 7 Then
Exit
EndIf
elseif $rady=7 Then
begin()
endif
Else
error()
EndIf
EndFunc
Func error() ;==>纠错的自定义涵数
$error=msgbox (4,"出错拉!","您可能没有输入用户名或密码,是否重新输入")
if $error = 6 Then
begin()
Else
Exit
EndIf
EndFunc
EndSwitch
WEnd
请高手看看那里错了
帮忙修正一下 |