Hi Andrew,<br><br>Thank you for giving me a good example. Though I haven'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"><<a href="mailto:aholden@charteroaksystems.com">aholden@charteroaksystems.com</a>></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> >> Using your approach, I need to use a case statement inside a message<br> loop.<br> ><br> > As you can see, struct Handler in my example doesn't have any case<br> statements<br> > as well.<br> > Again: the basic, lowlevel message processing is hidden - in my<br> example in the<br> > "button" class, in smart win++ somewhere in WidgetWindow or its base<br> classes.<br> > The *users* of the framework do not need to deal with messages as the<br> </div>> 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 <UINT, boost::signals2::signal <LRESULT (HWND, UINT,<br> WPARAM, LPARAM)> 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->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'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'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>