Solved

URGENT: ATL component to convert string

Posted on 2001-06-21
5
197 Views
Last Modified: 2013-11-25
I want to make an ATL component in Visual C++ (No MFC).
I want to make a function that converts a string, example:




HRESULT ConvertString( string  strSomething);
strSomething is an input / output parameter!!

2 questions:

- What type can I use for strSomething?
- What actions do I have to do to add the method to my component and export it?
(should I add it to the interface AND to the class or is there some kind of wizard? )

Thanks in advance!!!
0
Comment
Question by:MelissaC
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:migel
ID: 6213860
Hi!
1. COM interfaces use BSTR strings (UNICODE wide char strings),

2. You MUST define new interface (let it be : IStringConverter)
3. To do this you just in the ATL project
right click on the project name in the workspace class tab.
and choose New ATL object.
ATL "wizard" will apear - here you must set name for your interface and coClass.
4. after wizard finish you will see your new interface in the class tab
5. RightClick on the interface and choose Add method
6 in the appeared dialog type method name :
ConvertString
and its parameters:
[in, out, retval] BSTR bstrString;
click ok.
0
 
LVL 2

Expert Comment

by:tdubroff
ID: 6214430
I don't think you want retval in the attribute list.  If you do use retval in the attribute list, then I think your VB code would look like this:

' assume obj is an IStringConverter
dim str as String
str = "abl;kjadsf"
str = obj.ConvertString(str)  ' this line doesn't quite make sense

If you get rid of the retval, then the VB code would be:

dim str as String
str = "abl;kjadsf"
obj.ConvertString(str)
0
 
LVL 12

Accepted Solution

by:
migel earned 200 total points
ID: 6276373
Hey!
anybody here?
none???
so I lock this Q.
0
 
LVL 2

Expert Comment

by:tdubroff
ID: 6276397
Your lock is not an answer!  Kindly remove it.
0
 
LVL 12

Expert Comment

by:migel
ID: 6276524
But My previous comment is ansver.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

707 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