I'm stuck at setting value at object, can't google out some simple examples, may any of you help with this ?
So, i create com Variables, and receive reference objects. And then i need to change value of one of the objects. But cannot, where is the problem ?
Code: Select all
DataType := ComVar()
DataValue := ComVar()
Object.GetXData("", DataType.ref, DataValue.ref)
MsgBox % DataValue[][2] ; gives me stringA
DataValue[][2] := "stringB" ; does not set this value stringB, how do i set value ? __Set ?
MsgBox % DataValue[][2] ; returns same stringA
; Below, com function from forum
ComVar(Type=0xC)
{
static base := { __Get: "ComVarGet", __Set: "ComVarSet", __Delete: "ComVarDel" }
; Create an array of 1 VARIANT. This method allows built-in code to take
; care of all conversions between VARIANT and AutoHotkey internal types.
arr := ComObjArray(Type, 1)
; Lock the array and retrieve a pointer to the VARIANT.
DllCall("oleaut32\SafeArrayAccessData", "ptr", ComObjValue(arr), "ptr*", arr_data)
; Store the array and an object which can be used to pass the VARIANT ByRef.
return { ref: ComObject(0x4000|Type, arr_data), _: arr, base: base }
}