Functions > Misc >


VarGetType

Détermine le type interne d'un variant.

VarGetType ( expression )

Paramètre

expression Expression dont le type interne est à déterminer.

Valeur de retour

Retourne une chaîne représentant le type de l'expression.

Remarques

Consultez Types de données du langage pour une description détaillée.

IsInt() peut retourner des résultats différents puisqu'il essaie de convertir depuis un float, par exemple appeler VarGetType() avec une valeur de 2.0 retournera "Double", mais IsInt() retournera 1 pour la même valeur.

En relation

IsArray, IsBinary, IsBool, IsDllStruct, IsFloat, IsFunc, IsHWnd, IsInt, IsKeyword, IsObj, IsPtr, IsString

Exemple

#include <MsgBoxConstants.au3>

Local $aArray[2] = [1, "Example"]
Local $mMap[] ; à partir de la version 15
Local $dBinary = Binary("0x00204060")
Local $bBoolean = False
Local $pPtr = Ptr(-1)
Local $hWnd = WinGetHandle(AutoItWinGetTitle())
Local $iInt = 1
Local $fFloat = 2.0
Local $oObject = ObjCreate("Scripting.Dictionary")
Local $sString = "Some text"
Local $tStruct = DllStructCreate("wchar[256]")
Local $vKeyword = Default
Local $fuFunc = ConsoleWrite
Local $fuUserFunc = Test

MsgBox($MB_SYSTEMMODAL, "", _
        "Types de variable" & @CRLF & @CRLF & _
        "$aArray est de type: " & @TAB & @TAB & VarGetType($aArray) & @CRLF & _
        "$mMap est de type: "  & @TAB & @TAB & VarGetType($mMap) & @CRLF & _
        "$dBinary est de type: " & @TAB & @TAB & VarGetType($dBinary) & @CRLF & _
        "$bBoolean est de type: " & @TAB & @TAB & VarGetType($bBoolean) & @CRLF & _
        "$pPtr est de type: " & @TAB & @TAB & VarGetType($pPtr) & @CRLF & _
        "$hWnd est de type: " & @TAB & @TAB & VarGetType($hWnd) & @CRLF & _
        "$iInt est de type: " & @TAB & @TAB & VarGetType($iInt) & @CRLF & _
        "$fFloat est de type: " & @TAB & @TAB & VarGetType($fFloat) & @CRLF & _
        "$oObject est de type: " & @TAB & @TAB & VarGetType($oObject) & @CRLF & _
        "$sString est de type: " & @TAB & @TAB & VarGetType($sString) & @CRLF & _
        "$tStruct est de type: " & @TAB & @TAB & VarGetType($tStruct) & @CRLF & _
        "$vKeyword est de type: " & @TAB & @TAB & VarGetType($vKeyword) & @CRLF & _
        "MsgBox est de type: " & @TAB & @TAB & VarGetType(MsgBox) & @CRLF & _
        "$fuFunc est de type: " & @TAB & @TAB & VarGetType($fuFunc) & @CRLF & _
        "Func 'Test' est de type: " & @TAB & @TAB & VarGetType(Test) & @CRLF & _
        "$fuUserFunc est de type: " & @TAB & @TAB & VarGetType($fuFunc))

Func Test()
EndFunc   ;==>Test