views:

267

answers:

1

I'm working on a WTL project, actually WTL 8.1 with VS2008. In many tutorials I've seen the usage of _Module global variable, e.g: _Module.AddMessageLoop. My current application creates a CMessageLoop in the stack at WinMain and later calls the CMessageLoop::Run () method. So far, it's running well. Anyone the reason (if it's necessary) in latest WTL releases to call _Module.Init, _Module.Term and AddMessageLoop ?

Thanks.

+1  A: 

Calling AddMessageLoop lets your window class get a crack at messages before they're translated; the message loop will call your class's PreTranslateMessage method before calling TranslateMessage.

You need the Init and Term stuff if you're using COM.

Ryan Ginstrom