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. Add Window procedure to picture control

Add Window procedure to picture control

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsontutoriallearning
7 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.
  • G Offline
    G Offline
    Gopi Nath
    wrote on last edited by
    #1

    Hello, In a dialog, i have added picture control from resource. in this i am displaying an image accordingly at the runtime which is working fine. I need to zoom in / zoom out the displayed image according to mouse wheel move. I thought of adding window procedure to that picture control, so that i can handle mouse command over there. in MFC, i can see options and examples, but in win32 api, i dont know how to do that. Can anyone suggest me how to do. Regards, Gopi.

    C V 2 Replies Last reply
    0
    • G Gopi Nath

      Hello, In a dialog, i have added picture control from resource. in this i am displaying an image accordingly at the runtime which is working fine. I need to zoom in / zoom out the displayed image according to mouse wheel move. I thought of adding window procedure to that picture control, so that i can handle mouse command over there. in MFC, i can see options and examples, but in win32 api, i dont know how to do that. Can anyone suggest me how to do. Regards, Gopi.

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      This article series could possibly help: Custom Controls in Win32 API: The Basics[^].

      "In testa che avete, Signor di Ceprano?" -- Rigoletto

      G 1 Reply Last reply
      0
      • G Gopi Nath

        Hello, In a dialog, i have added picture control from resource. in this i am displaying an image accordingly at the runtime which is working fine. I need to zoom in / zoom out the displayed image according to mouse wheel move. I thought of adding window procedure to that picture control, so that i can handle mouse command over there. in MFC, i can see options and examples, but in win32 api, i dont know how to do that. Can anyone suggest me how to do. Regards, Gopi.

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        Just derive your own class from the CStatic (picture control is a static control), create the control member variable in the dialog for this picture control, and handle any Windows message you need in this derived class.

        G 1 Reply Last reply
        0
        • C CPallini

          This article series could possibly help: Custom Controls in Win32 API: The Basics[^].

          "In testa che avete, Signor di Ceprano?" -- Rigoletto

          G Offline
          G Offline
          Gopi Nath
          wrote on last edited by
          #4

          Thanks, will check on this.

          1 Reply Last reply
          0
          • V Victor Nijegorodov

            Just derive your own class from the CStatic (picture control is a static control), create the control member variable in the dialog for this picture control, and handle any Windows message you need in this derived class.

            G Offline
            G Offline
            Gopi Nath
            wrote on last edited by
            #5

            Thanks. my application is in win32 and picture control created through toolbox. how to subclass this control to CStatic (MFC) derived class?

            V 1 Reply Last reply
            0
            • G Gopi Nath

              Thanks. my application is in win32 and picture control created through toolbox. how to subclass this control to CStatic (MFC) derived class?

              V Offline
              V Offline
              Victor Nijegorodov
              wrote on last edited by
              #6

              1. Use MFC class Wizard to derive new MFC class from CStatic (say CMyPicture); 2. Change the control ID of your picture control from IDC_STATIC to something more sensible (like IDC_MYPICTURE); 3. Use MFC class Wizard to create the control member variable (of the new created type CMyPicture) for your picture control. Also see MSDH (docs.microsoft.com) for details.

              G 1 Reply Last reply
              0
              • V Victor Nijegorodov

                1. Use MFC class Wizard to derive new MFC class from CStatic (say CMyPicture); 2. Change the control ID of your picture control from IDC_STATIC to something more sensible (like IDC_MYPICTURE); 3. Use MFC class Wizard to create the control member variable (of the new created type CMyPicture) for your picture control. Also see MSDH (docs.microsoft.com) for details.

                G Offline
                G Offline
                Gopi Nath
                wrote on last edited by
                #7

                Thank you. Will give it a try.

                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