不停调用:AfxRegisterWndClass出现错误有关问题

不停调用::AfxRegisterWndClass出现异常问题在定时器里,每隔几秒钟调用::AfxRegisterWndClass函数,可是到

不停调用::AfxRegisterWndClass出现异常问题
在定时器里,每隔几秒钟调用::AfxRegisterWndClass函数,可是到了一定时候会出现异常,跟踪到系统代码里,停留在
//   the   buffer   is   of   fixed   size   --   ensure   that   it   does   not   overflow
ASSERT(lstrlen(lpszUnregisterList)   +   1   +
lstrlen(lpWndClass-> lpszClassName)   +   1   <
_countof(pModuleState-> m_szUnregisterList));
问题好象是注册的窗口太多了,导致窗口类链表益出,请问高手如何避免这种异常?

[解决办法]
为什么要不断注册,应该从程序结构上入手
[解决办法]
程序退出才会销毁注册过的窗口类。

手动销毁函数:

UnregisterClass Function

一般用不着吧?
[解决办法]
试试这个吧

UnregisterClass Function

--------------------------------------------

The UnregisterClass function unregisters a window class, freeing the memory required for the class.

Syntax

BOOL UnregisterClass( LPCTSTR lpClassName,
HINSTANCE hInstance
);