c++ - Why not have access to the element? -
here code:
#import "c:\...\.....\....tlb" using namespace std; int main() { hresult hr = coinitialize(null); _applicationptr myapp("indesign.application"); documentptr mydoc = myapp->activedocument; swatchesptr myswatches = mydoc->swatches; cout << "number of swatch: " << myswatches->count << endl; // count = 10 swatchptr first_swatch = myswatches->item[1l]; swatchptr second_swatch = myswatches->item[2l]; cout << first_swatch->name; // correctly cout << second_swatch->name; // crash cin.get(); return 0; }
why can not access elements? count 10. ideas?
the line swatchptr second_swatch = myswatches->item[2l];
compiles, empty.
error when accessing second_swatch->name
:
Comments
Post a Comment