Solved

How to hook a Combobox CloseUP event message?

Posted on 2008-06-19
4
790 Views
Last Modified: 2010-04-21
Hi
I have a standard combobox in a frame on a form. I have some code that makes the frame transparent i.e. it BitBlts the underlying portion of the form onto the frame with a mask to make it seem transparent (I have a gradient background on the form that I want the frame to show)
When the combobox is clicked, the drop down window covers part of my frame. When the drop down window closes the part of the frame under the dropdown window that was "transparent" now  shows the frame backcolour while the rest of the frame is transparent as before.
What I want to be a ble to do is hook the combo closeup message (or whatever the appropriate message is) to trigger a redraw of my frame transparency code.  I do not wish to use a timer to trigger the redraw repeatedly, I am looking for a lower level solution.
Thoughts?
Thanks in advance
Graeme
0
Comment
Question by:superg65
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 21827863
Subclass and get WM_COMMAND message and HiWord of wParam = CBN_CLOSEUP.
See code below:
   Case WM_COMMAND

      If lParam = m_hWnd Then

         ' Debug.Print "WM_COMMAND"

         Select Case (wParam \ &H10000) And &HFFFF&

         Case CBN_DBLCLK

            RaiseEvent DblClick

         Case CBN_DROPDOWN

            RaiseEvent DropDown

         Case CBN_CLOSEUP

            m_hWndDropDown = 0

            RaiseEvent CloseUp

         Case CBN_SETFOCUS, CBN_KILLFOCUS

            ' Not required, handed by UserControl

         Case CBN_SELCHANGE

            'Debug.Print "CBN_SELCHANGE", ListIndex, GetItemText(ListIndex)

            SetCboEditText GetItemText(ListIndex)

            RaiseEvent Change

            RaiseEvent Click

         Case CBN_EDITCHANGE

            RaiseEvent Change

         End Select

      End If

Open in new window

0
 
LVL 2

Author Comment

by:superg65
ID: 21828665
Hi
Looks like just what I was after. Will try it out tomorrow and get back to you.
Thanks G
0
 
LVL 2

Author Comment

by:superg65
ID: 21836352
Hi Danaseaman
Have not had a chance to test your solution today - sorry should get to it tomorrow but had to do stuff with my kids today.
After thinking about it a bit, I  have just raised another question related to this that you might like to have a look at
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23504174.html
Thanks
G

0
 
LVL 2

Author Closing Comment

by:superg65
ID: 31469033
Thanks for this. G
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now