Solved

URGENT: ATL component to convert string

Posted on 2001-06-21
5
231 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
EvenOdd challenge 10 128
mapAB Challlenge 35 160
What .NET URL re-routing tool did I use? 2 76
Problem to Office 1 18
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…

821 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