Skip to main content
gamedev.net
🔒 Locked

ATL programming

Started by Shadows 0 replies 900+ views
Original Post
Shadows
Shadows
Please help anyone!!! My problem is that when I programmed ActiveX dlls in VB and when I created the instances of them in VB they were separete instances, for example if a class had a String property and I created two instances of that class: Dim Object as DLLObject Dim Object2 as DLLObject Set Object = New DLLObject Set Object2 = New DLLObject the two classes and their internals were separete, i.e. I could set Object.String to "a" and Object2.String to "b" and Object.String would be "a" and vice versa. However when I''m programming ATL in C++ and I''m using the exact same client code Object.String and Object2.String would both be equal to whatever I sat the string to last, doesn''t matter if it''s Object or Object2. I suppose this means that they are both pointing to the same object and I also suppose that I have to change this in the internals of the dll. I hope that i''m making sense here, regards Fredrik. PS. Sorry about the spelling im swedish DS.
Shannon Barber
Shannon Barber
Use the _bstr_t class to deal with strings when programing COM interfaces in C++.

VB will copy the string automatically (as will the _bstr_t class), but a raw OLECHAR* will just point to the same string.

That''s my best guess as to what''s happening. It''s hard to tell without see the offending code.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.