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
Solved

CString as paramter in OCX method

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 109
simplest php form 3 80
C# application error "Parameter Is Not Valid". 3 111
Infrastructure development vs software development 3 60
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

789 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