Solved

XPCOM function returns nsAString

Posted on 2008-10-23
4
763 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

706 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

15 Experts available now in Live!

Get 1:1 Help Now