Get messages sent to external ComboBox

phil1950

New member
Joined
Jan 2, 2015
Messages
4
Programming Experience
1-3
If by Spy++ I select a ComboBox of an external application and then I get its messages I can see that the ComboBox is populated by a series of :


CB_ADDSTRING lpsz: (some hex number) ("String to add")


Now the question: knowing the ComboBox handle, how can I get these messages, exactly like Spy++ does? My goal is to get the several added strings before them are sorted in the ComboBox (that has the Sorted property = True)


I think by some sort of hooking, but while online I can find several examples of KEYBOARD hook and MOUSE hook, I can't find anything about a SINGLE CONTROL hook, like Spy++ seems to do without problems.


Some help?


Ty.
 
I believe that you can use the NativeWindow class for that. I'm not 100% sure whether NativeWindow works only for managed windows or any window, but that's the first place I would look. You define your own class that overrides the WndProc method, then create an instance of that class and call its AssignHandle method, passing the handle of the window you want to track. The WndProc method of your NativeWindow object should then be executed each time the native window receives a message. You implement that WndProc method to filter and process messages in whatever way you see fit.
 
Ty for the answer.. but I don't think the NativeWindow class can process messages for a window in another process, especially if the external process is NOT a .NET one.
 
Back
Top