回复 5# dnvplj
抱歉,你给出的示例代码中,不必要的定义实在不少,我看花眼了,所以在2楼搞错了读你配置文件的"意向值",
但该代码在无配置文件时,运行测试显示的结果无误,所以我坚持代码的正确性并无视了你3楼的要求,给出了4楼的新建议.
现在已经按你要求再次修改了自定义函数,希望顺利.
最后,希望你花点时间,对比下,1楼,2楼,以及这楼的代码, 从中找出你在3楼的疑问吧.#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Combo2 = GUICtrlCreateCombo("", 20, 80, 340, 23, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Label1 = GUICtrlCreateLabel("本地网卡:", 20, 150, 66, 17)
$L_NAptr = GUICtrlCreateLabel("", 86, 150, 330, 21)
$Label3 = GUICtrlCreateLabel("MAC地址:", 20, 190, 70, 17)
$L_MAC = GUICtrlCreateLabel("", 86, 190, 306, 17)
_Setini()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo2
_Setini(GUICtrlRead($Combo2))
EndSwitch
WEnd
Func _Setini($key = Default)
Local $Set_1 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network1|NAdapter", "Realtek PCIe GBE")
Local $Set_2 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network2|NAdapter", "Family Controller")
Local $Set_3 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network1|HAddress", "01-01-01-01-01-01")
Local $Set_4 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network2|HAddress", "02-02-02-02-02-02")
Local $Set_5 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network1|Name", "本地连接")
Local $Set_6 = IniRead(@ScriptDir & "\Soft.ini", "Network", "Network2|Name", "无线连接")
GUICtrlSetData($Combo2, '')
If IsKeyword($key) Or $key == $Set_5 Then
GUICtrlSetData($Combo2, $Set_5 & "|" & $Set_6, $Set_5)
GUICtrlSetData($L_NAptr, $Set_1)
GUICtrlSetData($L_MAC, $Set_3)
Else
GUICtrlSetData($Combo2, $Set_5 & "|" & $Set_6, $Set_6)
GUICtrlSetData($L_NAptr, $Set_2)
GUICtrlSetData($L_MAC, $Set_4)
EndIf
EndFunc ;==>_Setini
|