converting COleVariant to CString

Posted on 2000-04-28
Last Modified: 2013-11-20
How to convert a COleVariant to CString?
Question by:buccso
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 86

Accepted Solution

jkr earned 50 total points
ID: 2759029

COleVariant var;
CString str;

// ...

str = (LPCTSTR) var.bstrVal;

Author Comment

ID: 2759052
It only converts the first char of the string. To work correctly you have to skip the cast.

LVL 86

Expert Comment

ID: 2759074
You should have rejected insted of grading a 'D'...
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 2759104
With a simple modification it solved the problem. I couldn't reject it.
LVL 86

Expert Comment

ID: 2760517
'D' is 'hardly acceptable' - this is a bit insulting (at least for me)

Author Comment

ID: 2768417
I think you are a bit huffy. What does it matter, which greade do you get?

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question