Solved

CString as paramter in OCX method

Posted on 2006-06-22
2
351 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now