?
Solved

URGENT: ATL component to convert string

Posted on 2001-06-21
5
Medium Priority
?
253 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
[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
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 600 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…

718 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