Solved

XPCOM function returns nsAString

Posted on 2008-10-23
4
764 Views
Last Modified: 2013-12-07
Can someone provide me an example to XPCOM function which has a return value as nsAString?

Thanks,

MF
0
Comment
Question by:metalfish
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 500 total points
ID: 22794798
Interesting.  I cannot find any either.

I think there is probably some dark mysterious reason for that, but, in the meantime, if you just want to get a nsAString back from a function, pass one in as a reference, modifying it internally.  EG

void Function ( nsAString& strIN )
{
     // Modify strIN here
}

HTH
0
 

Author Comment

by:metalfish
ID: 22796066
Thanks. That works.

By the way, do you know how to convert .NET String to nsAString? Any example will be helpful.

MF
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 22796203
Glad to help.
>> By the way, do you know how to convert .NET String to nsAString? Any example will be helpful.
Without extensive research I cannot give you complete code to do this.  However, you can get a char* from a System.String (I assume that is what you mean when you say .NET string) by following the extensive advice here http://support.microsoft.com/kb/311259.  And according to https://developer.mozilla.org/en/XPCOM_string_guide, you can use nsDependentString to convert char* to nsAString(https://developer.mozilla.org/en/XPCOM_string_guide#Raw_Character_Pointers).  
HTH :o)
0
 

Author Comment

by:metalfish
ID: 22798285
I will look into that. Thanks again for the help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Several part series to implement Internet Explorer 11 Enterprise Mode
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

863 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

23 Experts available now in Live!

Get 1:1 Help Now