Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Promit

Using _bstr_t BSTR wrapper class?

This topic is 5841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Part 3 of my questions onabout the same topic. I''ve finally gotten C++ to (mostly)interact correctly with my VB ActiveX DLL. Problem is, string passing is kinda weird... I''m using #import directive and Smart COM pointers. The VB funcs that take strings are asking for an object of type _bstr_t, which is a wrapper for the wide character BSTR. At least, That''s what it looks like. I haven''t got any experience with writing Unicode compatible stuff. I''m trying to put basic text into this thing. I tried using swprintf with the second param as a string literal. It couldn''t make a string literal into a wchar_t. wchar_t is one of the types that I can give to the _bstr_t contructor and operator=. I can give it char* too, but I''m not sure that it is working, as my VB DLL does not seem to be getting the string. Any general help? ____________________________________________________________ Direct3D vs. OpenGL

Share this post


Link to post
Share on other sites
Advertisement
_bstr_t has convenient overloads for adding character strings, if memory serves. I think it also converts between narrow and wide strings.

If you want a wide string literal, you prepend the single or double quote marks with an L.

e.g. std::wstring myWideString(L"This is wide");




[edited by - DrPizza on May 30, 2002 11:49:32 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!