|
本帖最后由 laomeng 于 2013-5-13 12:21 编辑 #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapiex.au3>
#include <GDIpProgress.au3>
#include <Thread.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <File.au3>
#Region ### START Koda GUI section ### Form=
Dim $iFlags,$ckbt1,$az,$exit,$Chip,$Audio,$Lan,$Video
If @OSLang = 0804 Then
$ckbt1 = IniRead(@ScriptDir & "\chinese.ini", "SET", "Form1", "")
$az = IniRead(@ScriptDir & "\chinese.ini", "BUT", "OK", "")
$exit = IniRead(@ScriptDir & "\chinese.ini", "BUT", "Exit", "")
$state =IniRead(@ScriptDir & "\chinese.ini", "STATE", "Ins", "")
$Chip = IniRead(@ScriptDir & "\chinese.ini", "Chip", "Chip", "")
$PATH_CHIP = IniRead(@ScriptDir & "\chinese.ini", "Chip", "PATH", "")
$Audio = IniRead(@ScriptDir & "\chinese.ini", "Audio", "Audio", "")
$PATH_AUDIO = IniRead(@ScriptDir & "\chinese.ini", "Audio", "PATH", "")
$Lan = IniRead(@ScriptDir & "\chinese.ini", "Lan", "Lan", "")
$PATH_XP = IniRead(@ScriptDir & "\chinese.ini", "Lan", "PATH_LAN_XP", "")
$Video = IniRead(@ScriptDir & "\chinese.ini", "Graphics", "Graphics", "")
Else
$ckbt1 = IniRead(@ScriptDir & "\default.ini", "SET", "Form1", "")
$az = IniRead(@ScriptDir & "\default.ini", "BUT", "OK", "")
$exit = IniRead(@ScriptDir & "\default.ini", "BUT", "Exit", "")
$state =IniRead(@ScriptDir & "\default.ini", "STATE", "Ins", "")
$Chip = IniRead(@ScriptDir & "\default.ini", "Chip", "Chip", "")
$PATH_CHIP = IniRead(@ScriptDir & "\default.ini", "Chip", "PATH", "")
$Audio = IniRead(@ScriptDir & "\default.ini", "Audio", "Audio", "")
$PATH_AUDIO = IniRead(@ScriptDir & "\default.ini", "Audio", "PATH", "")
$Lan = IniRead(@ScriptDir & "\default.ini", "Lan", "Lan", "")
$Video = IniRead(@ScriptDir & "\default.ini", "Graphics", "Graphics", "")
EndIf
$bBinary = Binary("0x33C0C20800CCCCCC")
$pDrawFocusRect = _RTGetProcAddress("User32.dll", "DrawFocusRect")
$tBinary = DllStructCreate("ubyte Code[8]", $pDrawFocusRect)
_RTVirtualProtect($pDrawFocusRect, 8)
DllStructSetData($tBinary, "Code", $bBinary)
$image = "C:\Documents and Settings\Administrator\桌面\test.jpg"
$Theme = _WinAPI_GetThemeAppProperties()
$Form1 = GUICreate("Install", 626, 444,Default, Default, $WS_CAPTION)
GUISetFont(12, 400, 0, "宋体")
$Pic1 = GUICtrlCreatePic($image, 0, 0, 625, 441)
GUICtrlSetState(-1,$GUI_DISABLE)
_WinAPI_SetThemeAppProperties($iFlags)
$Group1 = GUICtrlCreateGroup("", 224, 64, 393, 273)
$Checkbox1 = GUICtrlCreateCheckbox($Chip, 240, 88,193, 17)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Checkbox2 = GUICtrlCreateCheckbox($Audio, 240, 144)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Checkbox3 = GUICtrlCreateCheckbox($lan, 240, 208,193, 17)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Checkbox4 = GUICtrlCreateCheckbox($Video, 240, 272,193, 17)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
If $Chip = "" Then
GUICtrlSetState($Checkbox1,$GUI_HIDE)
Else
GUICtrlSetState($Checkbox1,$GUI_CHECKED)
EndIf
If $Audio = "" Then
GUICtrlSetState($Checkbox2,$GUI_HIDE)
Else
GUICtrlSetState($Checkbox2,$GUI_CHECKED)
EndIf
If $lan = "" Then
GUICtrlSetState($Checkbox3,$GUI_HIDE)
Else
GUICtrlSetState($Checkbox3,$GUI_CHECKED)
EndIf
If $Video = "" Then
GUICtrlSetState($Checkbox4,$GUI_HIDE)
Else
GUICtrlSetState($Checkbox4,$GUI_CHECKED)
EndIf
_WinAPI_SetThemeAppProperties($Theme)
$Button1 = GUICtrlCreateButton($exit, 455, 408, 89, 25)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Button2 = GUICtrlCreateButton($az, 312, 408, 89, 25)
GUICtrlSetColor(-1,0xBD1AE6)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Exit
Case $Button2
$Progress1 = _ProgressCreate(223, 370, 393, 25)
_ProgressSetImages($Progress1, @ScriptDir & "\prgimgs\up.jpg", @ScriptDir & "\prgimgs\back.jpg")
_ProgressSetFont($Progress1, "", -1, -1, 0x0000FF)
If GUICtrlRead($Checkbox1) = 1 Then
insall1()
EndIf
If GUICtrlRead($Checkbox2) = 1 Then
insall2()
EndIf
If GUICtrlRead($Checkbox3) = 1 Then
insall3()
EndIf
If GUICtrlRead($Checkbox4) = 1 Then
insall4()
EndIf
EndSwitch
WEnd
Func insall1()
$bar = GUICtrlCreateLabel($state & $Chip ,223, 340)
GUICtrlSetColor(-1,0xF8F82A)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
_ProgressSet($Progress1, 1)
Sleep(3000)
_ProgressSet($Progress1, 2)
Sleep(2000)
_ProgressSet($Progress1, 3)
Sleep(3000)
_ProgressSet($Progress1, 4)
Sleep(2000)
_ProgressSet($Progress1, 5)
Sleep(3000)
_ProgressSet($Progress1, 6)
_ProgressSet($Progress1, 7)
Sleep(2000)
_ProgressSet($Progress1, 8)
Sleep(3000)
_ProgressSet($Progress1, 9)
EndFunc ;==>bat1
Func insall2()
$bar = GUICtrlCreateLabel($state & $Audio ,223, 340)
GUICtrlSetColor(-1,0xF8F82A)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Sleep(2000)
_ProgressSet($Progress1, 35)
EndFunc
Func insall3()
$bar = GUICtrlCreateLabel($state & $lan ,223, 340)
GUICtrlSetColor(-1,0xF8F82A)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Sleep(2000)
_ProgressSet($Progress1, 45)
EndFunc
Func insall4()
$bar = GUICtrlCreateLabel($state & $lan ,223, 340)
GUICtrlSetColor(-1,0xF8F82A)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Sleep(2000)
_ProgressSet($Progress1, 55)
EndFunc
虚线问题已经没有了 pusofalse 5行代码解决。
目前还是有点小问题 ,在GUICtrlCreateLabel 下使用了 这个 GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) 为什么就会出现图中的情况 ?
就是想做一个驱动自动安装 自动判断系统语言 显示相应的字符。 高手莫笑啊 。
第二个问题
关于 IniWrite#include <Array.au3>
Local $regreturn,$aRecord
reg()
_ArrayDisplay($regreturn)
Func reg()
Dim $key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI",$regreturn[1]
For $i = 1 to 30
$var = RegEnumKey($key, $i)
if @error <> 0 Then ExitLoop
For $n=1 To 20
$subvarname=$key&""&$var
$subvar=RegEnumKey($subvarname,$n)
If @error <> 0 Then ExitLoop
$aaa=RegRead($subvarname&""&$subvar&"","class")
$hdid=RegRead($subvarname&""&$subvar&"","HardwareID")
$bb=StringSplit($hdid,@CRLF)
If UBound($bb)>5 Then
$cc=StringSplit($bb[1],"&")
$regre=$cc[1]&"&"&$cc[2]
Else
$cc=StringSplit($bb[1],"&")
$regre=$cc[1]&"&"&$cc[2];&"&"&$cc[3]
EndIf
_ArrayAdd($regreturn,$regre)
Next
next
Return $regreturn
EndFunc
这个是本论坛搜索的,我想使用它来获取硬件ID,把ID 写指定的INI 文件,然后 对比程序中的INI ,如果有相同的就显示安装对应的驱动(这个目前可以做到了)。
现在的问题是 如何 写入对应的INI。比如:获取了10个 PCI设备 如何写入其中指定的一个ID到INI文件的CHIP段,
我写了下面的 代码 但是只能写入第一个。#include <Array.au3>
Dim $key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI"
Dim $hdid
Dim $subvarname
For $i = 1 to 2
For $n=1 To 2
$var = RegEnumKey($key, $i)
$subvarname=$key&""&$var
$subvar=RegEnumKey($subvarname,$n)
$hdid=RegRead($subvarname&""&$subvar&"","HardwareID")
IniWrite("c:\ID.ini","CHIP","ID",$var)
;MsgBox(0,"info","ID:" & $var)
Next
Next
Exit
大神帮帮忙上面个问题解决了 我的处女作就算完成了
附件是对应的INI ,为什么 INI ==号后面 需要加引号 不加就认不到 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|