Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Questions and answers from the newsgroups 2006 12 08

Return to mozilla-dev-extensions


FAQ

(↑ top)

Is there any way to get the MozillaContentWindowClass from an xpcom component?

From a simple XPCOM component you could try the following code:
 HWND hContent = 0;
 HWND hFF = ::FindWindowEx(0, 0, "MozillaUIWindowClass", 0);
 if (hFF) {
    HWND hTemp;
    hTemp = ::FindWindowEx(hFF, 0, "MozillaWindowClass", 0);
    hTemp = ::FindWindowEx(hTemp, 0, "MozillaWindowClass", 0);
    // assume only 1 window at this level has children
    // and the 1 with children is the one we want
    HWND hChild = ::GetWindow(hTemp, GW_CHILD);
    while (hTemp && !hChild) {
      hTemp = ::GetWindow(hTemp, GW_HWNDNEXT);
      hChild = ::GetWindow(hTemp, GW_CHILD);
    }
    // did we find a window with children?
    if (hTemp) {
      hTemp = ::GetWindow(hTemp, GW_CHILD);
      hContent = ::FindWindowEx(hTemp, 0, "MozillaContentWindowClass", 0);
    }
 }

UAQ

(↑ top)

Document Tags and Contributors

 Contributors to this page: Sheppy, DcbHs5, Mckwan
 Last updated by: Sheppy,