Solved

CString as paramter in OCX method

Posted on 2006-06-22
2
374 Views
Last Modified: 2010-04-17
Hi,
I am developing an OCX application.
I want to write a method using the class wizard. The method has a paramter of type CString, but the Class Wizard does not support the CString as a paramter type.

What shoud i use as a substitue.

Please help !!!
0
Comment
Question by:jhav1594
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 16966405
For COM methods, strings are passed as BSTR.
If you need to call such method having CString, use CString::AllocSysString method. Using API, BSTR can be created with SysAllocString method.
Inside of this function you can work with BSTR parameter using _bstr_t or CComBSTR wrappers.
0
 
LVL 5

Expert Comment

by:bastibartel
ID: 16966463
Simply use the class wizard to add a method with BSTR parameter.
The class wizard will do everything for you. - I mean, everything.



 
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Scripting vs. Programming languages 25 166
Adding Namespace to the second node of the xml 16 73
egit plugin on eclipse 8 64
sp_configure 'external scripts enabled', 1; 7 52
This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

803 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