开发者

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"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜