Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert 'const CString' to 'OLECHAR FAR*'

Posted on 2006-11-29
6
Medium Priority
?
1,825 Views
Last Modified: 2013-11-20
Hi guys,

How would I convert:

'const CString' to 'OLECHAR FAR*'


Cheers!
0
Comment
Question by:Cyber-Drugs
[X]
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
  • 2
6 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 18040160
I think this should work.

bstr_t bst = MyString;

SomeFunc(bst);  // SomeFunc(OLECHAR FAR* bst)
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18040212
What is MyString?
What is SomeFunc?

Sorry, that didn't make much sense to me...
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 1200 total points
ID: 18043013
Use CString::AllocSysString() like :

OLECHAR FAR *pOleString = strMyString.AllocSysString();

If you call CString::AllocSysString() like above then after use you should call SysFreeString(pOleString) to avoid memory leak.

OLECHAR FAR *pOleString = strMyString.AllocSysString();

//Use pOleString

::SysFreeString(pOleString)


-MAHESH
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 800 total points
ID: 18043435
How would I convert:

'const CString' to 'OLECHAR FAR*'


MyString is a CString variable
SomeFunc is a function that takes a parameter of type OLECHAR FAR*
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18045611
Cheers Andy!
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18045617
... and Mahesh, sorry I didn't see your reply. :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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