Gets the COM/OLE variant type of a WIL variable.
ObjectTypeGet( variable)
(s) value WIL variable that contains variant data.
(s) COM/OLE variant-type or a blank string (""). This function will return a blank string ("") if the variable passed is a non variant type.
"variant-type" can be one of the following:
Variant Type |
Meaning |
EMPTY |
No data, the size of the value is zero. |
NULL |
This is like a pointer to NULL. |
I1 |
1-byte signed integer. |
UI1 |
1-byte unsigned integer. |
I2 |
Two bytes representing a 2-byte signed integer value. |
UI2 |
2-byte unsigned integer. |
I4 |
4-byte signed integer value. |
INT |
4-byte signed integer value (equivalent to I4). |
UI4 |
4-byte unsigned integer. |
UINT |
4-byte unsigned integer (equivalent to UI4). |
I8 |
8-byte signed integer. |
UI8 |
8-byte unsigned integer. |
R4 |
32-bit IEEE floating point value. |
R8 |
64-bit IEEE floating point value. |
DECIMAL |
A decimal value, specified as a string in the form "#DECIMAL:value". |
CY |
A currency value, specified as a string in the form "#CURRENCY:value". |
DATE |
A date/time value, specified as a string in Ymd or YmdHms format |
BSTR |
A string. |
BOOL |
A Boolean (True/False) value |
ERROR |
A DWORD containing a status code. |
FILETIME |
64-bit FILETIME structure as defined by Win32. It is recommended that all times be stored in Universal Coordinate Time (UTC). |
LPSTR |
Pointer to a null-terminated ANSI string in the system default code page. |
LPWSTR |
Pointer to a null-terminated Unicode string in the user's default locale. |
CLSID |
Pointer to a class identifier (CLSID) (or other globally unique identifier (GUID)). |
CF |
Pointer to a CLIPDATA structure. |
BLOB |
DWORD count of bytes, followed by that many bytes of data. The byte count does not include the four bytes for the length of the count itself; an empty blob member would have a count of zero, followed by zero bytes. This is similar to the value BSTR but does not guarantee a null byte at the end of the data. |
BSTR_BLOB |
Reserved for system use |
BLOBOBJECT |
A blob member containing a serialized object in the same representation that would appear in STREAMED_OBJECT. That is, a DWORD byte count (where the byte count does not include the size of itself) which is in the format of a class identifier followed by initialization data for that class. The only significant difference between BLOB_OBJECT and STREAMED_OBJECT is that the former does not have the system-level storage overhead that the latter would have, and is therefore more suitable for scenarios involving numbers of small objects. |
STREAM |
Pointer to an IStream interface, representing a stream which is a sibling to the "Contents" stream. |
STREAMED_OBJECT |
As in STREAM, but indicates that the stream contains a serialized object, which is a CLSID followed by initialization data for the class. The stream is a sibling to the "Contents" stream that contains the property set. |
STORAGE |
Pointer to an IStorageinterface, representing a storage object that is a sibling to the "Contents" stream. |
STORED_OBJECT |
As in STORAGE, but indicates that the designated IStoragecontains a loadable object. |
VECTOR |
If the type indicator is combined with VECTOR by using an OR operator, the value is one of the counted array values. This creates a DWORD count of elements, followed by a pointer to the specified repetitions of the value. For example, a type indicator of LPSTR|VECTOR has a DWORD element count, followed by a pointer to an array of LPSTR elements. VECTOR can be combined by an OR operator with the following types: I1, UI1, I2, UI2, BOOL, I4, UI4, R4, R8, ERROR, I8, UI8, CY, DATE, FILETIME, CLSID, CF, BSTR, LPSTR, LPWSTR, and VARIANT. |
ARRAY |
If the type indicator is combined with ARRAY by an OR operator, the value is a pointer to a SAFEARRAY. ARRAY can use the OR with the following data types: I1, UI1, I2, UI2, I4, UI4, INT, UINT, R4, R8, BOOL, DECIMAL, ERROR, CY, DATE, and BSTR. ARRAY cannot use OR with VECTOR. |
BYREF |
If the type indicator is combined with BYREF by an OR operator, the value is a reference. Reference types are interpreted as a reference to data. BYREF can use OR with the following types: I1, UI1, I2, UI2, I4, UI4, INT, UINT, R4, R8, BOOL, DECIMAL, ERROR, CY, DATE, BSTR, ARRAY, and VARIANT. |
VARIANT |
A DWORD type indicator followed by the corresponding value. VARIANT can be used only with VECTOR or BYREF. |
DISPATCH |
A pointer to an object was specified. This object is known only to implement IDispatch. |
UNKNOWN |
A pointer to an object that implements the IUnknown interface. |
VOID |
VOID. |
HRESULT |
Standard return type |
SAFEARRAY |
ARRAY in VARIANT |
CARRAY |
C-style array |
USERDEFINED |
User-defined type. |
RECORD |
User-defined type. |
ILLEGAL |
|
RESERVED |
|
This function returns the "variant-type" string for the specified variable name, or "" if it does not have a variant type.
Important:
Note that some of these types do not work for Automation (IDispatch) method parameters and property values. They are included for completeness. Theoretically, WinBatch will support any variant data type as long as you don't try to pass it to WinBatch functions or use it in non-COM expressions. Of course we support all the variant types that can be converted to standard WIL types in any WinBatch expression or sub expression or function call.
objLocator = ObjectCreate("WbemScripting.SWbemLocator") objService = objLocator.ConnectServer(".","root/cimv2","","") objSecurity = objService.Security_ objSecurity.ImpersonationLevel = 3 class = "Win32_BIOS" ; query instances query = "SELECT * FROM Win32_BIOS WHERE Name = 'Default System BIOS' AND SoftwareElementID = 'Default System BIOS' AND SoftwareElementState = '3' AND TargetOperatingSystem = '0' AND Version = 'DELL - 6'" colInstances = objService.ExecQuery(query) ; loop once for each instance ForEach objInstance In colInstances ;Check if Object is EMPTY type = ObjectTypeGet(objInstance) If type=="EMPTY" Then Break ; obtain properti Message("Manufacturer",objInstance.Manufacturer) Next ; close object handles colInstances = "" objSecurity = "" objService = "" objLocator = ""
COM/OLE, ObjectOpen, ObjectClose, ObjectType, BinaryAllocArray