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. C / C++ / MFC
  4. custom controls

custom controls

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
9 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.
  • W Offline
    W Offline
    Waldermort
    wrote on last edited by
    #1

    I have created a custom control to diaplay a rather compilcated bitmap on the main window. Now I can trap every message I need except for the WM_EXITSIZEMOVE, and this is probably the most important of them all. I only want to resize the bitmap after the user has finished resizing the main window. I can re-create the effect by sending a message to the control from the main window, but this defeats the purpose of having a custom control in the first place. Is there any way to detect when the parent window has completed a resize?

    Waldermort

    C 1 Reply Last reply
    0
    • W Waldermort

      I have created a custom control to diaplay a rather compilcated bitmap on the main window. Now I can trap every message I need except for the WM_EXITSIZEMOVE, and this is probably the most important of them all. I only want to resize the bitmap after the user has finished resizing the main window. I can re-create the effect by sending a message to the control from the main window, but this defeats the purpose of having a custom control in the first place. Is there any way to detect when the parent window has completed a resize?

      Waldermort

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      i've done this by waiting for a mouse button Up message. if you've received a bunch of WM_SIZE messages, then a WM_LBUTTONUP, you can assume the resize is done. or, if you haven't received a WM_SIZE msg in X seconds, you can assume the resize has stopped.

      image processing toolkits | batch image processing

      W 2 Replies Last reply
      0
      • C Chris Losinger

        i've done this by waiting for a mouse button Up message. if you've received a bunch of WM_SIZE messages, then a WM_LBUTTONUP, you can assume the resize is done. or, if you haven't received a WM_SIZE msg in X seconds, you can assume the resize has stopped.

        image processing toolkits | batch image processing

        W Offline
        W Offline
        Waldermort
        wrote on last edited by
        #3

        Could the solution have come any easier? What can I say, it's been a long day... Thanks for the answer :)

        Waldermort

        1 Reply Last reply
        0
        • C Chris Losinger

          i've done this by waiting for a mouse button Up message. if you've received a bunch of WM_SIZE messages, then a WM_LBUTTONUP, you can assume the resize is done. or, if you haven't received a WM_SIZE msg in X seconds, you can assume the resize has stopped.

          image processing toolkits | batch image processing

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          I'm probably missing something stupid, but I'm not getting any mouse messages whatsoever. I added the window using the resource editor specifying the 'custom' window and my own registered class. The 'enabled' and 'visible' flags are both set, so why can't I recieve any input?

          Waldermort

          C 1 Reply Last reply
          0
          • W Waldermort

            I'm probably missing something stupid, but I'm not getting any mouse messages whatsoever. I added the window using the resource editor specifying the 'custom' window and my own registered class. The 'enabled' and 'visible' flags are both set, so why can't I recieve any input?

            Waldermort

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #5

            is any other control/window in your app doing a SetCapture ?

            image processing toolkits | batch image processing

            W 1 Reply Last reply
            0
            • C Chris Losinger

              is any other control/window in your app doing a SetCapture ?

              image processing toolkits | batch image processing

              W Offline
              W Offline
              Waldermort
              wrote on last edited by
              #6

              No, so far I only have a main window which does nothing except display my new custom control. I'm currently reading the articles on "custom controls" hoping to spot something I have missed, but they are all geared towards MFC which I'm not using.

              Waldermort

              M 1 Reply Last reply
              0
              • W Waldermort

                No, so far I only have a main window which does nothing except display my new custom control. I'm currently reading the articles on "custom controls" hoping to spot something I have missed, but they are all geared towards MFC which I'm not using.

                Waldermort

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                Do you have a WM_NCHITTEST handler that's indicating the cursor is in the NC area of the window? IOW, is it a client area/non-client area issue? WM_EXITSIZEMOVE should be sufficient if using the system resizing loop. Mark

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                W 1 Reply Last reply
                0
                • M Mark Salsbery

                  Do you have a WM_NCHITTEST handler that's indicating the cursor is in the NC area of the window? IOW, is it a client area/non-client area issue? WM_EXITSIZEMOVE should be sufficient if using the system resizing loop. Mark

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  W Offline
                  W Offline
                  Waldermort
                  wrote on last edited by
                  #8

                  Yes, it was a NCHITTEST issue, I was returning the wrong value. Nomatter what I tried, I just cannot trap the WM_EXITSIZEMOVE. I am going to have to take Chris' approach and set a flag on a WM_SIZE event. But since I will only recieve mouse messages when the mouse is over the window I will have to use some type of timer. Luckily for me though, I have a thread running to monitor any changes required in the bitmap.

                  Waldermort

                  M 1 Reply Last reply
                  0
                  • W Waldermort

                    Yes, it was a NCHITTEST issue, I was returning the wrong value. Nomatter what I tried, I just cannot trap the WM_EXITSIZEMOVE. I am going to have to take Chris' approach and set a flag on a WM_SIZE event. But since I will only recieve mouse messages when the mouse is over the window I will have to use some type of timer. Luckily for me though, I have a thread running to monitor any changes required in the bitmap.

                    Waldermort

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #9

                    WalderMort wrote:

                    I will have to use some type of timer.

                    A timer? Really?  Hmmm, ok.  This doesn't seem like it should be necessary if all the hittest messages are handled properly. Between SetCapture(), TrackMouseEvent(), and WM_MOUSELEAVE there shouldn't be issues with the cursor moving outside the window. Are you doing your own modal resize loop or relying on the system one? It probably bugs you too, but timers in these situations are an extreme, last-resort, cheesy solution IMO :) Mark

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                    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