View Full Version : Dialogs with menu's in WTL
Dan MacDonald
08-27-2003, 09:49 AM
Well my favorite Win32 UI api WTL is a great api, all of the ease of mfc without any of the bloat or dependancies. Unfortunatly it's realeased "Unsupported" my microsoft, it just sort of exsists as a resource for developers to figure out. So there's not a lot of documentation on it, on the off chance that someone here uses WTL i'd thought I'd ask the following question...
I've been able to configure a dialog to have a menu, but i'm not having any luck configuring the dialog class's message map so that it will trap menu events, allowing me to create command handlers for the various menu items. Any insight would be appreciated.
Siebharinn
08-27-2003, 10:18 AM
All of that MFC bloat is really documentation. :)
Ugh...third edit in five minutes, I'll get it right eventually.
BEGIN_MSG_MAP_EX(MyClass)
COMMAND_ID_HANDLER_EX(ID_MENUITEM, OnHandler)
END_MSG_MAP()
void OnHandler(UINT msg, int id, HWND control);
Dan MacDonald
08-27-2003, 12:31 PM
I got that far however the problem is deeper, it doesn't appear that my dialog is registered to recieve the WM_MENUXXX messages.
Dan MacDonald
08-28-2003, 08:53 AM
Interestingly enough, I got frustrated re-created the project, resources and message maps and everything worked correctly. Stuff like that can be a little annoying some times, I dislike it when things "magically" start working.
Siebharinn
08-28-2003, 09:13 AM
Heh. I did a small test project this morning just to see if I could get it to work, and was just coming here to tell you that it had.
Do you know why WTL is undocumented and unsupported? It's pretty slick, once you get past the initial learning curve.
Dan MacDonald
08-28-2003, 01:25 PM
From what I know, WTL started out as an ATL SDK sample. As an exercise one of the dudes on the ATL team showed how you could use ATL to implement a handful of the MFC classes and create windows gui's for ATL com applications. It really caught on with developers and before you know it, applications were being shipped based on the atlctls.h SDK sample.
So a bunch of the younger generation coders at microsoft fleshed it out and filled in a lot of the gaps. The old guard, the MFC croud, pretty much crushed it, but it was so popular with the development community that microsoft now releases it unsupported. Yeah the learning curve is tough, but once you acquire the knowlege it makes win32 GUI programming in C a real joy. I believe the latest version of WTL is 7.0 and includes VC7.0 (.NET) compatibility, you can get it off of msdn with a quick search :)