Hi Andrew,<br><br>Thank you for giving me a good example. Though I haven&#39;t yet bothered to look into the SmartWin++ source code but I suspect they have done something more smarter.<br><br>Thank you all.<br><br>-Asif<br>
<br><div class="gmail_quote">On Thu, Mar 24, 2011 at 7:12 PM, Andrew Holden <span dir="ltr">&lt;<a href="mailto:aholden@charteroaksystems.com">aholden@charteroaksystems.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thursday, March 24, 2011 8:42 AM, Igor R wrote:<br>
&gt;&gt; Using your approach, I need to use a case statement inside a message<br>
loop.<br>
&gt;<br>
&gt; As you can see, struct Handler in my example doesn&#39;t have any case<br>
statements<br>
&gt; as well.<br>
&gt; Again: the basic, lowlevel message processing is hidden - in my<br>
example in the<br>
&gt; &quot;button&quot; class, in smart win++ somewhere in WidgetWindow or its base<br>
classes.<br>
&gt; The *users* of the framework do not need to deal with messages as the<br>
</div>&gt; framework exposes higher-level facilities.<br>
<br>
Perhaps you can replace the switch statement with a map or similar<br>
(warning: untested):<br>
<br>
typedef std::map &lt;UINT, boost::signals2::signal &lt;LRESULT (HWND, UINT,<br>
WPARAM, LPARAM)&gt; MessageMap;<br>
MessageMap message_map;<br>
<br>
LRESULT CALLBACK WindowProc(<br>
 �__in �HWND hwnd,<br>
 �__in �UINT uMsg,<br>
 �__in �WPARAM wParam,<br>
 �__in �LPARAM lParam<br>
)<br>
{<br>
 � � � �MessageMap::const_iterator handler = message_map.find (uMsg);<br>
 � � � �if (handler != message_map.end())<br>
 � � � �{<br>
 � � � � � � � �return handler-&gt;second (hwnd, uMsg, wParam, lParam);<br>
 � � � �}<br>
 � � � �else<br>
 � � � �{<br>
 � � � � � � � �return DefWindowProc (hwnd, uMsg, wParam, lParam);<br>
 � � � �}<br>
}<br>
<br>
You could then insert any handler for any message into message_map. �I&#39;m<br>
not sure what combiner would be most appropriate here. �There is also<br>
the question of where message_map should really go. �A global variable<br>
(as my example implies) probably isn&#39;t the best place.<br>
<div><div></div><div class="h5">_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
</div></div></blockquote></div><br>