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. Resizing a window

Resizing a window

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++learning
5 Posts 2 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.
  • C Offline
    C Offline
    Craig Longman
    wrote on last edited by
    #1

    I'm writing a plug-in for an NLE, and I wish to forcibly resize my window to fill the area that is available. The PlugInPP class is defined as such:

    class ATL_NO_VTABLE CPluginPP :
    public CComObjectRootEx<CComMultiThreadModel>,
    public CComCoClass<CPluginPP, &CLSID_PluginPP>,
    public IPropertyPageImpl<CPluginPP>,
    public CDialogImpl<CPluginPP>

    In order to get the sizing messages for the parent window, I have sub-classed it, and when I see a WM_SIZE message, I do the following:

    ::MoveWindow( Main_zMappingArray[ 0 ].hDialogWnd,
    0,
    0,
    LOWORD( lParam ),
    HIWORD( lParam ),
    TRUE );

    My PlugInPP::OnSize method gets called with the new size, no problem there. However, there is immediately another WM_SIZE message setting back the original sizes or the dialog resource. I'm beginning to think that the silly buggers have subclassed the PlugInPP window and resize it whenever they see a WM_SIZE message, but that seems like an awful lot of work to do in a situation where the window is by no means resize-able. Give the ATL::CDialogIMpl and ATL::IPropertyPageImpl base classes, I'm wondering if there's a trick to resizing them, or a trick to preventing them from being resized that I can opt out of. Otherwise, I guess I'm stuck with subclassing my own window again, and just eating the WM_SIZE messages, and hope that works.

    CraigL

    C 2 Replies Last reply
    0
    • C Craig Longman

      I'm writing a plug-in for an NLE, and I wish to forcibly resize my window to fill the area that is available. The PlugInPP class is defined as such:

      class ATL_NO_VTABLE CPluginPP :
      public CComObjectRootEx<CComMultiThreadModel>,
      public CComCoClass<CPluginPP, &CLSID_PluginPP>,
      public IPropertyPageImpl<CPluginPP>,
      public CDialogImpl<CPluginPP>

      In order to get the sizing messages for the parent window, I have sub-classed it, and when I see a WM_SIZE message, I do the following:

      ::MoveWindow( Main_zMappingArray[ 0 ].hDialogWnd,
      0,
      0,
      LOWORD( lParam ),
      HIWORD( lParam ),
      TRUE );

      My PlugInPP::OnSize method gets called with the new size, no problem there. However, there is immediately another WM_SIZE message setting back the original sizes or the dialog resource. I'm beginning to think that the silly buggers have subclassed the PlugInPP window and resize it whenever they see a WM_SIZE message, but that seems like an awful lot of work to do in a situation where the window is by no means resize-able. Give the ATL::CDialogIMpl and ATL::IPropertyPageImpl base classes, I'm wondering if there's a trick to resizing them, or a trick to preventing them from being resized that I can opt out of. Otherwise, I guess I'm stuck with subclassing my own window again, and just eating the WM_SIZE messages, and hope that works.

      CraigL

      C Offline
      C Offline
      Craig Longman
      wrote on last edited by
      #2

      Hoping someone can still provide some help here, this is some update on what I've been finding; but one Q at a time so it doesn't seem so haphazard. When I subclass the propertypage/dialog, the previous proc address I get is an address well within the range that the Modules tab in VSW shows me user32.dll was loaded, so from that I can be fairly certain that the containing application is NOT subclassing it and simply re-initiating a MoveWindow whenever it sees a specific message. Is this correct? Or if it is not a safe assumption, any pointers on where/how to figure out who all is busy subclassing and 'walk the tree'? Thanks,

      CraigL

      1 Reply Last reply
      0
      • C Craig Longman

        I'm writing a plug-in for an NLE, and I wish to forcibly resize my window to fill the area that is available. The PlugInPP class is defined as such:

        class ATL_NO_VTABLE CPluginPP :
        public CComObjectRootEx<CComMultiThreadModel>,
        public CComCoClass<CPluginPP, &CLSID_PluginPP>,
        public IPropertyPageImpl<CPluginPP>,
        public CDialogImpl<CPluginPP>

        In order to get the sizing messages for the parent window, I have sub-classed it, and when I see a WM_SIZE message, I do the following:

        ::MoveWindow( Main_zMappingArray[ 0 ].hDialogWnd,
        0,
        0,
        LOWORD( lParam ),
        HIWORD( lParam ),
        TRUE );

        My PlugInPP::OnSize method gets called with the new size, no problem there. However, there is immediately another WM_SIZE message setting back the original sizes or the dialog resource. I'm beginning to think that the silly buggers have subclassed the PlugInPP window and resize it whenever they see a WM_SIZE message, but that seems like an awful lot of work to do in a situation where the window is by no means resize-able. Give the ATL::CDialogIMpl and ATL::IPropertyPageImpl base classes, I'm wondering if there's a trick to resizing them, or a trick to preventing them from being resized that I can opt out of. Otherwise, I guess I'm stuck with subclassing my own window again, and just eating the WM_SIZE messages, and hope that works.

        CraigL

        C Offline
        C Offline
        Craig Longman
        wrote on last edited by
        #3

        Well, I did finally manage to figure it out. The containing app was moving it, but using the IPropertyPageImpl::Move method. Why they didn't see fit to call it MoveWindow like every other single thing in windows, is beyond me. If I'd been able to figure out how to configure a breakpoint for whenever my DLL was entered, I'd have found it in no time.

        CraigL

        B 1 Reply Last reply
        0
        • C Craig Longman

          Well, I did finally manage to figure it out. The containing app was moving it, but using the IPropertyPageImpl::Move method. Why they didn't see fit to call it MoveWindow like every other single thing in windows, is beyond me. If I'd been able to figure out how to configure a breakpoint for whenever my DLL was entered, I'd have found it in no time.

          CraigL

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          Craig Longman wrote:

          If I'd been able to figure out how to configure a breakpoint for whenever my DLL was entered, I'd have found it in no time.

          Well, you can temporarily insert DebugBreak() into the code next time...

          C 1 Reply Last reply
          0
          • B Blake Miller

            Craig Longman wrote:

            If I'd been able to figure out how to configure a breakpoint for whenever my DLL was entered, I'd have found it in no time.

            Well, you can temporarily insert DebugBreak() into the code next time...

            C Offline
            C Offline
            Craig Longman
            wrote on last edited by
            #5

            Thanks, but that actually wouldn't have helped. The point was I didn't know where the host app was calling in. So, short of adding in a call like that to every method, as well as every method of every base class, there was no solution that I could program in. Breaking on MyDLL.dll!* is pretty much the only solution. Even the Class::* didn't work, as the parser failed to find some of the templatized based classes. Again, manually going through each and every base and adding breakpoints in would have caught them for each class that I tediously added them all in, but I was really hoping to get a better idea of when anything was called by the host app.

            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