SAFEARRAY SafeArrayCreate  SafeArrayDestroy

    // Specify the bounds:
    // -- dim. count = 2
    // -- element count = 8 for each dimension
    // -- low bound = 0 for each dimension
    SAFEARRAYBOUND mySafeArrayBounds[2] = { {8, 0}, {8, 0}};
 
    // Create mySafeArray
    SAFEARRAY *mySafeArray =
        SafeArrayCreate(VT_I2 /* var. type: 2 byte signed int */ ,
        2 /* dim. count */ , mySafeArrayBounds);
 
    // Set value 100 to element [3][7]
    int16_t *elementPtr = ((int16_t*)mySafeArray->pvData) +
        3 * mySafeArray->rgsabound[0].cElements + 7;
    *elementPtr = 100;
 
    // Destroy mySafeArray
    SafeArrayDestroy(mySafeArray);

 

posted on 2015-02-06 09:21  lypzxy  阅读(254)  评论(0编辑  收藏  举报