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. How to hook CBN_DROPDOWN and CBN_CLOSEUP ?

How to hook CBN_DROPDOWN and CBN_CLOSEUP ?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 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.
  • A Offline
    A Offline
    alikalik
    wrote on last edited by
    #1

    Hello, I've created a new class MyComboBox, derieved from CComboBox. I need to hook CBN_DROPDOWN and CBN_CLOSEUP messages and I do it in this way:

    LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch(message)
    {
    case CBN_DROPDOWN:
    fn1();
    break;
    case CBN_CLOSEUP:
    fn2();
    break;
    }

    return CComboBox::WindowProc(message, wParam, lParam);
    

    }

    But that doesn't work. What can cause the problem?

    N D 2 Replies Last reply
    0
    • A alikalik

      Hello, I've created a new class MyComboBox, derieved from CComboBox. I need to hook CBN_DROPDOWN and CBN_CLOSEUP messages and I do it in this way:

      LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
      {
      switch(message)
      {
      case CBN_DROPDOWN:
      fn1();
      break;
      case CBN_CLOSEUP:
      fn2();
      break;
      }

      return CComboBox::WindowProc(message, wParam, lParam);
      

      }

      But that doesn't work. What can cause the problem?

      N Offline
      N Offline
      norish
      wrote on last edited by
      #2

      Check http://msdn.microsoft.com/en-us/library/aa921578.aspx[^]

      A 1 Reply Last reply
      0
      • A alikalik

        Hello, I've created a new class MyComboBox, derieved from CComboBox. I need to hook CBN_DROPDOWN and CBN_CLOSEUP messages and I do it in this way:

        LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
        {
        switch(message)
        {
        case CBN_DROPDOWN:
        fn1();
        break;
        case CBN_CLOSEUP:
        fn2();
        break;
        }

        return CComboBox::WindowProc(message, wParam, lParam);
        

        }

        But that doesn't work. What can cause the problem?

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Why are you not implementating handlers for CBN_DROPDOWN and CBN_CLOSEUP? What version of Visual Studio are you using?

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        A 1 Reply Last reply
        0
        • D David Crow

          Why are you not implementating handlers for CBN_DROPDOWN and CBN_CLOSEUP? What version of Visual Studio are you using?

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          A Offline
          A Offline
          alikalik
          wrote on last edited by
          #4

          Visual Studio 2005 Standard Edition.

          1 Reply Last reply
          0
          • N norish

            Check http://msdn.microsoft.com/en-us/library/aa921578.aspx[^]

            A Offline
            A Offline
            alikalik
            wrote on last edited by
            #5

            LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
            {
            switch((int)LOWORD(wParam))
            {
            case CBN_DROPDOWN:
            fn1();
            break;
            }

            return CComboBox::WindowProc(message, wParam, lParam);
            

            }

            I tried this already, but the problem still exists :(

            N 1 Reply Last reply
            0
            • A alikalik

              LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
              {
              switch((int)LOWORD(wParam))
              {
              case CBN_DROPDOWN:
              fn1();
              break;
              }

              return CComboBox::WindowProc(message, wParam, lParam);
              

              }

              I tried this already, but the problem still exists :(

              N Offline
              N Offline
              norish
              wrote on last edited by
              #6

              Have you read this part?

              This message is sent when the list box of a combo box is about to be made visible.
              The parent window of the combo box receives this message through the WM_COMMAND message.

              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