|
-
December 22nd, 2005, 04:03 AM
#1
Single Event Handle for Multiple Controls
Greetings,
I have a program that creates a number of activeX controls. That number is not known until run time. I achive this by having a dynamic array of control pointers allocated once the number of controls needed is know. When creating the controls I must give them a unique ID which I do by starting the ID count from a specific value and incrimenting it for every control. This works fine.
However I want to capture messages fired by these controls. The ugly way to do this would be to write an event handler for evry control and every message, but as I do not know the number of controls until run time, I won't know how many controls event handlers to code.
A nicer solution would be to use ON_CONTROL_RANGE http://msdn.microsoft.com/library/de...trol_range.asp which forwards events from controls with IDs of the specified consecutive range to a single function.
However once in that function I have no way of knowing controls was the one that fired the message in the first place. Does anybody have any other ideas of how this can be achieved? I want one function to handle all messages fired by a number of controls, and I want to still be able to know (preferably inside the handling function) the ID of the control that fired that message.
Thanks,
Aristotel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|