Re: Firefox 3.6 : How can I obtain a HWND from the corresponding nsIDOMDocument object?
David Bolter <[email protected]>
| Newsgroups | gmane.comp.mozilla.accessibility |
|---|---|
| Message-ID | <[email protected]> |
That was of course added as part of bug 352093. Great! cheers, David On 25/02/10 9:29 AM, Oliveiros wrote: > Hi , Alexander. > > That was precisely the API I did use, GetRootWidget() > > Thank you for your suggestion > > Best, > Oliveiros Cristina > > 2010/2/25 Alexander Surkov<[email protected]> > > >> On Feb 24, 8:25 pm, "Oliveiros C,"<[email protected]> >> wrote: >> >>> Dear List, >>> >>> I have this code , in which spiDocument is an nsIDOMDocument. >>> >>> nsresult lReturnVal; >>> >>> HWND hWnd=NULL,hParentWindow; >>> >>> nsCOMPtr<nsIDocument> spiDoc = do_QueryInterface(spiDocument); >>> >>> nsIPresShell *piShell = spiDoc -> GetPrimaryShell(); >>> >>> if (piShell) >>> >>> { >>> >>> // Find hWnd >>> >>> nsIViewManager* piViewManager = piShell -> GetViewManager(); >>> >>> if (piViewManager) >>> >>> { >>> >>> nsCOMPtr<nsIWidget> spiWidget; >>> >>> piViewManager -> GetWidget(getter_AddRefs(spiWidget)); >>> >>> if (spiWidget) >>> >>> hWnd = static_cast<HWND> (spiWidget -> GetNativeData(NS_NATIVE_WINDOW)); >>> >>> }//if >>> }//if >>> >>> hParentWindow = GetAncestor(hWnd,GA_ROOT); >>> >>> return hWnd; >>> >>> This used to work on previous versions of xulrunner, but on the newest >>> >> xulrunner 1.9.2 it doesnt work, because the GetWidget() method is no longer >> supported by the nsIViewManager interface. >> >>> Can anyone please kindly point me the correct way to handle this (new) >>> >> situation? >> >>> Thanx in advance, >>> >>> Best, >>> >>> Oliveiros d'Azevedo Cristina >>> >> You could use GetRootWidget() like we do (see >> >> http://mxr.mozilla.org/mozilla-central/source/accessible/src/base/nsDocAccessible.cpp#111 >> ) >> >> Alex. >> _______________________________________________ >> dev-accessibility mailing list >> [email protected] >> https://lists.mozilla.org/listinfo/dev-accessibility >> >> > _______________________________________________ > dev-accessibility mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-accessibility >