Module WTL 8.0_模块和消息循环

Module WTL 8.0_模块和消息循环,module,wtl,message-loop,Module,Wtl,Message Loop,我正在做一个WTL项目,实际上是VS2008的WTL8.1。在许多教程中,我看到了_Module全局变量的用法,例如:_Module.AddMessageLoop。我当前的应用程序在WinMain的堆栈中创建了一个CMessageLoop,然后调用CMessageLoop::Run()方法。到目前为止,它运行良好。有人知道在最新的WTL版本中调用_Module.Init、_Module.Term和AddMessageLoop的原因吗(如果有必要) 谢谢。调用AddMessageLoop可以让您的

我正在做一个WTL项目,实际上是VS2008的WTL8.1。在许多教程中,我看到了_Module全局变量的用法,例如:_Module.AddMessageLoop。我当前的应用程序在WinMain的堆栈中创建了一个CMessageLoop,然后调用CMessageLoop::Run()方法。到目前为止,它运行良好。有人知道在最新的WTL版本中调用_Module.Init、_Module.Term和AddMessageLoop的原因吗(如果有必要)


谢谢。

调用AddMessageLoop可以让您的窗口类在消息被翻译之前对其进行破解;消息循环将在调用TranslateMessage之前调用类的PreTranslateMessage方法

如果使用COM,则需要Init和Term内容