Try this:
nsCOMPtr<nsIServiceManager> serviceMgr;
rv = NS_GetServiceManager(getter_AddRefs(serviceMgr));
if (NS_FAILED(rv))
return rv; nsCOMPtr<nsIHttpProtocolHandler> httpHandler;
rv = serviceMgr->getServiceByContractID(
"@mozilla.org/network/protocol;1?name=http",
NS_GET_IID(nsIHttpProtocolHandler),
getter_AddRefs(httpHandler));
if (NS_FAILED(rv))
return rv; nsEmbedCString ua;
rv = httpHandler->GetUserAgent(ua);
if (NS_FAILED(rv))
return rv;You could also query the "misc" member to access the "rv:1.6" portion of the UA directly:
nsEmbedCString misc;
rv = httpHandler->GetMisc(misc);
if (NS_FAILED(rv))
return rv;It really is a shame that you can't easily query this information. I think we should really export a version check function from xpcom. That would be easy to implement since we have a MOZILLA_VERSION #define.
-Darin
Dmitriy B. wrote:
Thank you for this replay. This is realy bad news for me. Maybe is a way to get UserAgent string using XPCOM without creating browsers instance?:((
Best regards, Dmitriy
PS. Sorry for my English.
"Darin Fisher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
isThere isn't a good API for this (that i'm aware of) unfortunately. However, on each system that has a GRE installed, there are platform specific ways to determine the version of the GRE installed. There's good info on how to do this on the WIN32 platform here:
http://www.mozilla.org/projects/embedding/GRE.html
I hope that helps, -Darin
Dmitriy B. wrote:
I would like to detect the minor and major version of XPCOM library which
raiseloaded by my application.
If my application is not supports this version of XPCOM i am going to
error message. Does you have any suggestion?
Best regadrs, Dmitriy
"Doug Turner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
mostThere isn't an explict way to do what you are asking. I guess you can try to use the version in the XPCOMFunctions, but I am not sure that is going to get you what you want.
What are you trying to do? Doug Turner
Dmitriy B. wrote:
I found the XPCOMFunctions struct which are having version field but
likely can't use it.
Any ideas ?
"Dmitriy B." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Hello. Subj.
Is it possible at all?
Best regards, Dmitriy
_______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom
_______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
