函数参考


_GUICtrlIpAddress_SetArray

设置IP地址控件中的地址

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetArray($hWnd, $aAddress)

参数

$hWnd 控件句柄
$aAddress 下方格式的数组:
[0] - 第一个地址段
[1] - 第二个地址段
[2] - 第三个地址段
[3] - 第四个地址段

返回值

None.

注意/说明

None.

相关

_GUICtrlIpAddress_GetArray

示例/演示


#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
    Local $hgui, $aIP[4] = [24, 168, 2, 128], $hIPAddress

    $hgui = GUICreate("IP Address Control Set (Array) Example", 400, 300)
    $hIPAddress = _GUICtrlIpAddress_Create($hgui, 2, 4, 125, 20)
    $iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    _GUICtrlIpAddress_SetArray($hIPAddress, $aIP)

    $aIP = _GUICtrlIpAddress_GetArray($hIPAddress)

    MemoWrite("Field 1 .....: " & $aIP[0])
    MemoWrite("Field 2 .....: " & $aIP[1])
    MemoWrite("Field 3 .....: " & $aIP[2])
    MemoWrite("Field 4 .....: " & $aIP[3])

    ; Wait for user to close GUI
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; 写入一行到 memo 控件
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite