Re: dynamic create of controls, how to receive events?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 05/13/04


Date: Thu, 13 May 2004 14:50:26 -0400


"Martin Ortiz" <martin@enigmasoftwaregroup.com> wrote in message
news:OfnpkpPOEHA.640@TK2MSFTNGP12.phx.gbl
> I need to dynamically create buttons. Dynamically creating buttons is
> easy in atl, I just need to use whatever variant of "create" to do it.

When you say buttons, do you mean standard Windows push button controls,
or some kind of ActiveX control? I'm assuming the former.

> I need advice deciding on which would be best method to deal with
> "button clicks"....(that is, informing container of button click
> event occurred.

Assign a unique ID to each button. Handle WM_COMMAND message in the
message map of the parent window. The clicked button's ID comes as a
parameter to the message.

-- 
With best wishes,
    Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

Quantcast