Click to See Complete Forum and Search --> : repost : can't get WM_LBUTTONDOWN in subclass window procedure of Combobox
Ali Imran
August 5th, 2005, 04:22 PM
I am posting this question again only because the provious topic I posted had wrong title and no one repled it only becuase of its title (title had invalid message name).
ok here I go with question
Problem :
1. I created a combobox using class COMBOBOXEX
2. Then I subclassed it and in its subclass window procedure I wish to receive WM_LBUTTONDOWN, but unfortunately it drops down the list when clicked instead of giving me message WM_LBUTTONDOWN.
Question:
Is there any way I can prevent combo from dropping the list and get the mouse key down message in any form ?
any help is highly appreciated.
regards
Runt888
August 5th, 2005, 10:27 PM
I have a combobox that I have subclassed. When I capture the WM_LBUTTONDOWN and WM_LBUTTONDBLCLK messages and return 0, the list does not drop down. So the real question is, why are you not getting the mouse messages?
If you can post your code it will make it much easier for us to provide help,
Kelly
Ali Imran
August 6th, 2005, 01:39 PM
When I capture the WM_LBUTTONDOWN and WM_LBUTTONDBLCLK messages and return 0, the list does not drop down
Absolutely not. actually I am not even getting message becuase the list drops down when combo is clicked. I never received WM_LBUTTONDOWN. I want t oreceive WM_LBUTTONDOWN from subclassed combo.
I hope it is clear now.
switch(message) {
case WM_BUTTONDOWN: //I want to receive this, but it is not beign received
..........
}
regards
Runt888
August 6th, 2005, 02:20 PM
I understand what you want. I'm saying, I have a subclassed combobox that receives mouse events and allows me to stop the list from dropping down. So there must be something wrong with what you're doing that's preventing you from getting mouse events.
If you copied and pasted the code you posted, then you have WM_BUTTONDOWN, not WM_LBUTTONDOWN. But I would imagine that is just a typo, as WM_BUTTONDOWN isn't defined and would cause a compiler error.
If you can post more of your code, then we have a better chance of finding what is wrong.
Kelly
Ali Imran
August 6th, 2005, 04:22 PM
my mistake, WM_BUTTONDOWN is just type in the post not in the code actually.
code compiles perfectly sine it has WM_LBUTTONDOWN.
so here it is again
switch(message) {
case WM_LBUTTONDOWN: //I want to receive this, but it is not beign received
..........
}
regards
Runt888
August 6th, 2005, 06:54 PM
Are you receiving any messages in your window procedure?
Without more code, I can't really give you any more advice.
Kelly
mistersulu
January 27th, 2006, 08:30 AM
The only way to override the default action of the combobox's windoproc, i.e. dropping down the list on a click, is to replace it with your own.
crappy code... d'oh
//... your RepWndProc should return
// ::CallWindowProc((WNDPROC) ::GetWindowLongPtr(hWnd, GWLP_USERDATA), ...);
::SetWindowLongPtr(hComboWnd, GWLP_USERDATA, PtrToLong(::GetWindowLongPtr(hComboWnd, GWLP_WNDPROC)));
The RepWndProc will recv WM_LBUTTONDOWN.
sulu
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.