i remember using something like this in the wrapper, for a complex object in my c++/arx days many moons ago:
in the .h
STDMETHOD(get_ColorHatch)(/*[out, retval]*/ VARIANT *pv);
STDMETHOD(put_ColorHatch)(/*[in]*/ VARIANT var);
in the .cpp
STDMETHODIMP CClosedPolygonWrapper::put_ColorHatch(VARIANT var)
{
static AcGsColor AcadColors [] =
{
{255, 255, 255, 255}, //----- 0 - ByBlock - White
{255, 0, 0, 255}, //----- 1 - Red
{255, 255, 0, 255}, //----- 2 - Yellow
{0, 255, 0, 255}, //----- 3 - Green
{0, 255, 255, 255}, //----- 4 - Cyan
{0, 0, 255, 255}, //----- 5 - Blue
{255, 0, 255, 255}, //----- 6 - Magenta
{255, 255, 255, 255}, //----- 7 - White
{128, 128, 128, 255}, //----- 8
{192, 192, 192, 255}, //----- 9
{255, 0, 0, 255}, //----- 10
{255, 127, 127, 255}, //----- 11
{204, 0, 0, 255}, //----- 12
{204, 102, 102, 255}, //----- 13
{153, 0, 0, 255}, //----- 14
{153, 73, 73, 255}, //----- 15
{127, 0, 0, 255}, //----- 16
{127, 63, 63, 255}, //----- 17
{76, 0, 0, 255}, //----- 18
{76, 38, 38, 255}, //----- 19
{255, 63, 0, 255}, //----- 20
{255, 159, 127, 255}, //----- 21
{204, 51, 0, 255}, //----- 22
{204, 127, 102, 255}, //----- 23
{153, 38, 0, 255}, //----- 24
{153, 95, 76, 255}, //----- 25
{127, 31, 0, 255}, //----- 26
{127, 79, 63, 255}, //----- 27
{76, 19, 0, 255}, //----- 28
{76, 47, 38, 255}, //----- 29
{255, 127, 0, 255}, //----- 30
{255, 191, 127, 255}, //----- 31
{204, 102, 0, 255}, //----- 32
{204, 153, 102, 255}, //----- 33
{153, 76, 0, 255}, //----- 34
{153, 114, 76, 255}, //----- 35
{127, 63, 0, 255}, //----- 36
{127, 95, 63, 255}, //----- 37
{76, 38, 0, 255}, //----- 38
{76, 57, 38, 255}, //----- 39
{255, 191, 0, 255}, //----- 40
{255, 223, 127, 255}, //----- 41
{204, 153, 0, 255}, //----- 42
{204, 178, 102, 255}, //----- 43
{153, 114, 0, 255}, //----- 44
{153, 133, 76, 255}, //----- 45
{127, 95, 0, 255}, //----- 46
{127, 111, 63, 255}, //----- 47
{76, 57, 0, 255}, //----- 48
{76, 66, 38, 255}, //----- 49
{255, 255, 0, 255}, //----- 50
{255, 255, 127, 255}, //----- 51
{204, 204, 0, 255}, //----- 52
{204, 204, 102, 255}, //----- 53
{153, 153, 0, 255}, //----- 54
{153, 153, 76, 255}, //----- 55
{127, 127, 0, 255}, //----- 56
{127, 127, 63, 255}, //----- 57
{76, 76, 0, 255}, //----- 58
{76, 76, 38, 255}, //----- 59
{191, 255, 0, 255}, //----- 60
{223, 255, 127, 255}, //----- 61
{153, 204, 0, 255}, //----- 62
{178, 204, 102, 255}, //----- 63
{114, 153, 0, 255}, //----- 64
{133, 153, 76, 255}, //----- 65
{95, 127, 0, 255}, //----- 66
{111, 127, 63, 255}, //----- 67
{57, 76, 0, 255}, //----- 68
{66, 76, 38, 255}, //----- 69
{127, 255, 0, 255}, //----- 70
{191, 255, 127, 255}, //----- 71
{102, 204, 0, 255}, //----- 72
{153, 204, 102, 255}, //----- 73
{76, 153, 0, 255}, //----- 74
{114, 153, 76, 255}, //----- 75
{63, 127, 0, 255}, //----- 76
{95, 127, 63, 255}, //----- 77
{38, 76, 0, 255}, //----- 78
{57, 76, 38, 255}, //----- 79
{63, 255, 0, 255}, //----- 80
{159, 255, 127, 255}, //----- 81
{51, 204, 0, 255}, //----- 82
{127, 204, 102, 255}, //----- 83
{38, 153, 0, 255}, //----- 84
{95, 153, 76, 255}, //----- 85
{31, 127, 0, 255}, //----- 86
{79, 127, 63, 255}, //----- 87
{19, 76, 0, 255}, //----- 88
{47, 76, 38, 255}, //----- 89
{0, 255, 0, 255}, //----- 90
{127, 255, 127, 255}, //----- 91
{0, 204, 0, 255}, //----- 92
{102, 204, 102, 255}, //----- 93
{0, 153, 0, 255}, //----- 94
{76, 153, 76, 255}, //----- 95
{0, 127, 0, 255}, //----- 96
{63, 127, 63, 255}, //----- 97
{0, 76, 0, 255}, //----- 98
{38, 76, 38, 255}, //----- 99
{0, 255, 63, 255}, //----- 100
{127, 255, 159, 255}, //----- 101
{0, 204, 51, 255}, //----- 102
{102, 204, 127, 255}, //----- 103
{0, 153, 38, 255}, //----- 104
{76, 153, 95, 255}, //----- 105
{0, 127, 31, 255}, //----- 106
{63, 127, 79, 255}, //----- 107
{0, 76, 19, 255}, //----- 108
{38, 76, 47, 255}, //----- 109
{0, 255, 127, 255}, //----- 110
{127, 255, 191, 255}, //----- 111
{0, 204, 102, 255}, //----- 112
{102, 204, 153, 255}, //----- 113
{0, 153, 76, 255}, //----- 114
{76, 153, 114, 255}, //----- 115
{0, 127, 63, 255}, //----- 116
{63, 127, 95, 255}, //----- 117
{0, 76, 38, 255}, //----- 118
{38, 76, 57, 255}, //----- 119
{0, 255, 191, 255}, //----- 120
{127, 255, 223, 255}, //----- 121
{0, 204, 153, 255}, //----- 122
{102, 204, 178, 255}, //----- 123
{0, 153, 114, 255}, //----- 124
{76, 153, 133, 255}, //----- 125
{0, 127, 95, 255}, //----- 126
{63, 127, 111, 255}, //----- 127
{0, 76, 57, 255}, //----- 128
{38, 76, 66, 255}, //----- 129
{0, 255, 255, 255}, //----- 130
{127, 255, 255, 255}, //----- 131
{0, 204, 204, 255}, //----- 132
{102, 204, 204, 255}, //----- 133
{0, 153, 153, 255}, //----- 134
{76, 153, 153, 255}, //----- 135
{0, 127, 127, 255}, //----- 136
{63, 127, 127, 255}, //----- 137
{0, 76, 76, 255}, //----- 138
{38, 76, 76, 255}, //----- 139
{0, 191, 255, 255}, //----- 140
{127, 223, 255, 255}, //----- 141
{0, 153, 204, 255}, //----- 142
{102, 178, 204, 255}, //----- 143
{0, 114, 153, 255}, //----- 144
{76, 133, 153, 255}, //----- 145
{0, 95, 127, 255}, //----- 146
{63, 111, 127, 255}, //----- 147
{0, 57, 76, 255}, //----- 148
{38, 66, 76, 255}, //----- 149
{0, 127, 255, 255}, //----- 150
{127, 191, 255, 255}, //----- 151
{0, 102, 204, 255}, //----- 152
{102, 153, 204, 255}, //----- 153
{0, 76, 153, 255}, //----- 154
{76, 114, 153, 255}, //----- 155
{0, 63, 127, 255}, //----- 156
{63, 95, 127, 255}, //----- 157
{0, 38, 76, 255}, //----- 158
{38, 57, 76, 255}, //----- 159
{0, 63, 255, 255}, //----- 160
{127, 159, 255, 255}, //----- 161
{0, 51, 204, 255}, //----- 162
{102, 127, 204, 255}, //----- 163
{0, 38, 153, 255}, //----- 164
{76, 95, 153, 255}, //----- 165
{0, 31, 127, 255}, //----- 166
{63, 79, 127, 255}, //----- 167
{0, 19, 76, 255}, //----- 168
{38, 47, 76, 255}, //----- 169
{0, 0, 255, 255}, //----- 170
{127, 127, 255, 255}, //----- 171
{0, 0, 204, 255}, //----- 172
{102, 102, 204, 255}, //----- 173
{0, 0, 153, 255}, //----- 174
{76, 76, 153, 255}, //----- 175
{0, 0, 127, 255}, //----- 176
{63, 63, 127, 255}, //----- 177
{0, 0, 76, 255}, //----- 178
{38, 38, 76, 255}, //----- 179
{63, 0, 255, 255}, //----- 180
{159, 127, 255, 255}, //----- 181
{51, 0, 204, 255}, //----- 182
{127, 102, 204, 255}, //----- 183
{38, 0, 153, 255}, //----- 184
{95, 76, 153, 255}, //----- 185
{31, 0, 127, 255}, //----- 186
{79, 63, 127, 255}, //----- 187
{19, 0, 76, 255}, //----- 188
{47, 38, 76, 255}, //----- 189
{127, 0, 255, 255}, //----- 190
{191, 127, 255, 255}, //----- 191
{102, 0, 204, 255}, //----- 192
{153, 102, 204, 255}, //----- 193
{76, 0, 153, 255}, //----- 194
{114, 76, 153, 255}, //----- 195
{63, 0, 127, 255}, //----- 196
{95, 63, 127, 255}, //----- 197
{38, 0, 76, 255}, //----- 198
{57, 38, 76, 255}, //----- 199
{191, 0, 255, 255}, //----- 200
{223, 127, 255, 255}, //----- 201
{153, 0, 204, 255}, //----- 202
{178, 102, 204, 255}, //----- 203
{114, 0, 153, 255}, //----- 204
{133, 76, 153, 255}, //----- 205
{95, 0, 127, 255}, //----- 206
{111, 63, 127, 255}, //----- 207
{57, 0, 76, 255}, //----- 208
{66, 38, 76, 255}, //----- 209
{255, 0, 255, 255}, //----- 210
{255, 127, 255, 255}, //----- 211
{204, 0, 204, 255}, //----- 212
{204, 102, 204, 255}, //----- 213
{153, 0, 153, 255}, //----- 214
{153, 76, 153, 255}, //----- 215
{127, 0, 127, 255}, //----- 216
{127, 63, 127, 255}, //----- 217
{76, 0, 76, 255}, //----- 218
{76, 38, 76, 255}, //----- 219
{255, 0, 191, 255}, //----- 220
{255, 127, 223, 255}, //----- 221
{204, 0, 153, 255}, //----- 222
{204, 102, 178, 255}, //----- 223
{153, 0, 114, 255}, //----- 224
{153, 76, 133, 255}, //----- 225
{127, 0, 95, 255}, //----- 226
{127, 63, 111, 255}, //----- 227
{76, 0, 57, 255}, //----- 228
{76, 38, 66, 255}, //----- 229
{255, 0, 127, 255}, //----- 230
{255, 127, 191, 255}, //----- 231
{204, 0, 102, 255}, //----- 232
{204, 102, 153, 255}, //----- 233
{153, 0, 76, 255}, //----- 234
{153, 76, 114, 255}, //----- 235
{127, 0, 63, 255}, //----- 236
{127, 63, 95, 255}, //----- 237
{76, 0, 38, 255}, //----- 238
{76, 38, 57, 255}, //----- 239
{255, 0, 63, 255}, //----- 240
{255, 127, 159, 255}, //----- 241
{204, 0, 51, 255}, //----- 242
{204, 102, 127, 255}, //----- 243
{153, 0, 38, 255}, //----- 244
{153, 76, 95, 255}, //----- 245
{127, 0, 31, 255}, //----- 246
{127, 63, 79, 255}, //----- 247
{76, 0, 19, 255}, //----- 248
{76, 38, 47, 255}, //----- 249
{51, 51, 51, 255}, //----- 250
{91, 91, 91, 255}, //----- 251
{132, 132, 132, 255}, //----- 252
{173, 173, 173, 255}, //----- 253
{214, 214, 214, 255}, //----- 254
{255, 255, 255, 255}, //----- 255
{255, 255, 255, 255} //----- ByLayer - White
};
// To use the AcPexCtl ActiveX object to marshal true color,
// you must pass an IAcadAcCmColor dispatch pointer through, wrapped
// in a variant.
AcAxDocLock docLock(m_objRef.objectId(), AcAxDocLock::kNormal);
if(docLock.lockStatus() != Acad::eOk && docLock.lockStatus() != Acad::eNoDatabase)
return E_ACCESSDENIED;
AcAxObjectRefPtr<ClosedPolygon> obj(&m_objRef, AcDb::kForWrite);
if (obj.openStatus() != Acad::eOk)
return E_ACCESSDENIED;
CComQIPtr<IAcadAcCmColor> pColor;
HRESULT hr = pColor.CoCreateInstance(CLSID_AcadAcCmColor);
// Set the marshalling object
pColor=var.pdispVal;
AcCmEntityColor tbackcolor;
long colorVal;
pColor->get_EntityColor(&colorVal);
tbackcolor.setColor(colorVal);
// color is by index - convert it to AcCmEntityColor !
if (tbackcolor.isByACI())
{
//acutPrintf(_T("\nColor is by index. "));
AcGsColor col;
col = AcadColors[tbackcolor.colorIndex()];
tbackcolor.setRGB(col.m_red, col.m_green, col.m_blue);
}
obj->ColorHatch(tbackcolor);
Fire_Notification(DISPID_COLORHATCH);
return S_OK;
}
in the .idl
[propget, id(2), helpstring("Returns the truecolor of the hatch object.")] HRESULT ColorHatch([out, retval] VARIANT* pv);
[propput, id(2), helpstring("Returns the truecolor of the hatch object.")] HRESULT ColorHatch([in] VARIANT var);
hope that will help somehow...