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