Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. In my BHO, how to react to window move or resize?

In my BHO, how to react to window move or resize?

Scheduled Pinned Locked Moved ATL / WTL / STL
helpquestionjavascripttutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tommy Svensson
    wrote on last edited by
    #1

    Hi again, I discovered a new problem and I have to share this with you as I can't solve this on my own... :( My Browser Helper Object creates a window (inherits from CDialogImpl). I've managed to position this window in the lower right corner of Internet Explorer but the problem is that whenever the user resizes or moves Internet Explorer, my window stays put. I would like to move my little window as the parent window (IE) moves. How can my window react upon move/resize messages from the parent window (IE)? BTW: My window steals the focus once it's displayed, how can I give the focus back to IE? All help is grea... well, you know I love you guys! /T

    P 1 Reply Last reply
    0
    • T Tommy Svensson

      Hi again, I discovered a new problem and I have to share this with you as I can't solve this on my own... :( My Browser Helper Object creates a window (inherits from CDialogImpl). I've managed to position this window in the lower right corner of Internet Explorer but the problem is that whenever the user resizes or moves Internet Explorer, my window stays put. I would like to move my little window as the parent window (IE) moves. How can my window react upon move/resize messages from the parent window (IE)? BTW: My window steals the focus once it's displayed, how can I give the focus back to IE? All help is grea... well, you know I love you guys! /T

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Tommy Svensson wrote:

      BTW: My window steals the focus once it's displayed, how can I give the focus back to IE?

      I can answer this part of your qestion. Get handle to browser, as stated in last reply. And use SendMessage.

      i.e.
      SendMessage(hWnd,WM_SETFOCUS,0,0);//hWnd is handle to browser

      Prasad Notifier using ATL | Operator new[],delete[][^]

      T 1 Reply Last reply
      0
      • P prasad_som

        Tommy Svensson wrote:

        BTW: My window steals the focus once it's displayed, how can I give the focus back to IE?

        I can answer this part of your qestion. Get handle to browser, as stated in last reply. And use SendMessage.

        i.e.
        SendMessage(hWnd,WM_SETFOCUS,0,0);//hWnd is handle to browser

        Prasad Notifier using ATL | Operator new[],delete[][^]

        T Offline
        T Offline
        Tommy Svensson
        wrote on last edited by
        #3

        Thx Prasad, the latter part now solved! Thx. Still, this question remains unanswered: My Browser Helper Object creates a window (inherits from CDialogImpl). I've managed to position this window in the lower right corner of Internet Explorer but the problem is that whenever the user resizes or moves Internet Explorer, my window stays put. I would like to move my little window as the parent window (IE) moves. How can my window react upon move/resize messages from the parent window (IE)? /Tommy

        J 1 Reply Last reply
        0
        • T Tommy Svensson

          Thx Prasad, the latter part now solved! Thx. Still, this question remains unanswered: My Browser Helper Object creates a window (inherits from CDialogImpl). I've managed to position this window in the lower right corner of Internet Explorer but the problem is that whenever the user resizes or moves Internet Explorer, my window stays put. I would like to move my little window as the parent window (IE) moves. How can my window react upon move/resize messages from the parent window (IE)? /Tommy

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          Tommy Svensson wrote:

          How can my window react upon move/resize messages from the parent window (IE)?

          If you manage to get a handle to IE's main window (a HWND), then you have the alternative to subclass that window, and trap relevant messages. Please have a look at CContainedWindowT<Tbase, TWinTraits>, ALT_MSG_MAP(), and Subclass(). Here's the pseudo code:

          class YourControl {
          ...
          CContainedWindow m_wndIE;

          BEGIN_MSG_MAP(YourControl)
          ...
          ALT_MSG_MAP(1)
          // Message handlers
          MESSAGE_HANDLER(WM_SIZE, OnIESize)
          END_MSG_MAP()
          };

          YourControl::YourControl() : m_wndIE(this, 1 /* Message map ID - see ALT_MSG_MAP())
          {
          }

          void YourControl::SomeMethod()
          {
          HWND hWndIE = ...;
          m_wndIE.SubclassWindow(hWndIE);
          }

          LRESULT YourControl::OnIESize(...)
          {
          // Do stuff BEFORE IE gets the message here
          LRESULT lResult = DefWindowProc(); // Call IEs handler
          // Do stuff AFTER IE gets the message here
          return lResult; // Patch through whatever IE returned
          }

          Unless IE is doing something totally radical, this approach should work. I'm assuming that IEs message pump is the same thread as your control. If it's not, well, then I'm not so sure that it'll work.. Lycka till!

          -- Verletzen zerfetzen zersetzen zerstören Doch es darf nicht mir gehören Ich muss zerstören

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups