Compare Revisions

Questions and answers from the newsgroups 2006 12 08

Change Revisions

Revision 188243:

Revision 188243 by Mckwan on

Revision 188244:

Revision 188244 by Mckwan on

Title:
Questions and answers from the newsgroups 2006 12 08
Questions and answers from the newsgroups 2006 12 08
Slug:
Extensions/Questions_and_answers_from_the_newsgroups_2006_12_08
Extensions/Questions_and_answers_from_the_newsgroups_2006_12_08
Content:

Revision 188243
Revision 188244
tt19    <div class="note">
20      <p>
21        ===[http://groups.google.com/group/mozilla.dev.extensions
 >/browse_thread/thread/4f0a7e786b98e2af Is there any way to get th
 >e MozillaContentWindowClass from an xpcom component&nbsp;?]===
22      </p>
23      <dl>
24        <dd>
25          From a simple XPCOM component you could try the followi
 >ng code:
26        </dd>
27      </dl>
28      <pre class="eval">
29 HWND hContent = 0;
30 HWND hFF = ::FindWindowEx(0, 0, "MozillaUIWindowClass", 0);
31 if (hFF) {
32    HWND hTemp;
33    hTemp = ::FindWindowEx(hFF, 0, "MozillaWindowClass", 0);
34    hTemp = ::FindWindowEx(hTemp, 0, "MozillaWindowClass", 0);
35</pre>
36      <pre class="eval">
37    // assume only 1 window at this level has children
38    // and the 1 with children is the one we want
39    HWND hChild = ::GetWindow(hTemp, GW_CHILD);
40    while (hTemp &amp;&amp; !hChild) {
41      hTemp = ::GetWindow(hTemp, GW_HWNDNEXT);
42      hChild = ::GetWindow(hTemp, GW_CHILD);
43    }
44</pre>
45      <pre class="eval">
46    // did we find a window with children?
47    if (hTemp) {
48      hTemp = ::GetWindow(hTemp, GW_CHILD);
49      hContent = ::FindWindowEx(hTemp, 0, "MozillaContentWindowCl
 >ass", 0);
50    }
51 }
52</pre>
53    </div>

Back to History