UDF > GUI > GuiIPAddress >


_GUICtrlIpAddress_Create

Cr�e un contr�le IPAddress qui g�re une adresse IP (Internet Protocol)

#include <GuiIPAddress.au3>
_GUICtrlIpAddress_Create ( $hWnd, $iX, $iY [, $iWidth = 125 [, $iHeight = 25 [, $iStyles = 0x00000000 [, $iExstyles = 0x00000000]]]] )

Param�tres

$hWnd Handle du parent ou de la fen�tre propri�taire
$iX Position horizontale du contr�le
$iY Position verticale du contr�le
$iWidth [optionnel] Largeur du contr�le
$iHeight [optionnel] Hauteur du contr�le
$iStyles [optionnel] Styles du contr�le:
For��s: $WS_CHILD, $WS_VISIBLE, $WS_TABSTOP
$iExStyles [optionnel] Styles �tendus du contr�le. Ils correspondent aux constantes standards $WS_EX_*. Consultez Table des styles �tendus.

Valeur de retour

Succ�s: Retourne le handle du contr�le IPAddress.
�chec: Retourne 0.

Remarque

Le contr�le IPAddress contient l'adresse d'un ordinateur sur un r�seau IP.

En relation

_GUICtrlIpAddress_Destroy

Exemple

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

Global $g_hIPAddress

Example()

Func Example()
    Local $hGui

    $hGui = GUICreate("IP Address Control Create Example", 400, 300)
    $g_hIPAddress = _GUICtrlIpAddress_Create($hGui, 10, 10)
    GUISetState(@SW_SHOW)

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    _GUICtrlIpAddress_Set($g_hIPAddress, "24.168.2.128")

    ; Attend que l'utilisateur ferme la GUI
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iCode, $tNMHDR
    Local $tInfo

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
    If $hWndFrom = $g_hIPAddress Then
        If $iCode = $IPN_FIELDCHANGED Then 
            ; Envoy� quand l'utilisateur modifie un champ du contr�le ou se d�place d'un champ � un autre
            $tInfo = DllStructCreate($tagNMIPADDRESS, $lParam)
            _DebugPrint("$IPN_FIELDCHANGED" & @CRLF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _
                "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _
                "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _
                "-->Field:" & @TAB & DllStructGetData($tInfo, "Field") & @CRLF & _
                "-->Value:" & @TAB & DllStructGetData($tInfo, "Value"))
            ; La valeur retourn�e est ignor�e
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint