C++ and Scripting.Dictionary from scrrun.dll
I have some trouble with Scripting.Dictionary in C++. I'm trying to use interface IDictionary via smart pointer but methods of creating object don开发者_如何学Go't work and I can't understand why.
CoInitialize(NULL);
IDictionaryPtr dict;
dict.CreateInstance(__uuidof(Dictionary));
_variant_t num1 = 1;
_variant_t num2 = 2;
dict->Add(&num1, &num2);
long i;
dict->get_Count(&i);
cout << i << "\n";
But method Add does not work and cout of elements in dictionary is always 0. How correct to use Scripting.Dictionary in that case. PS.: I'm getting Scripting interfaces by #import "scrrun.dll"
精彩评论