这是由registerclass(ex)引起的Windows错误(设施7,错误代码1410)。此示例代码复制它:
#include "stdafx.h"
#include <windows.h>
#include <assert.h>
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, int)
{
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.hInstance = hInstance;
wcex.lpszClassName = L"Example";
ATOM at1 = RegisterClassEx(&wcex);
assert(at1 != 0);
// Register again, should fail with error 1410
ATOM at2 = RegisterClassEx(&wcex);
assert(at2 == 0);
int err = GetLastError();
assert(err == ERROR_CLASS_ALREADY_EXISTS);
return 0;
}
在代码中查找coclass使用registerclass(ex)的地方。当实例被破坏时,它必须使用UnregisterClass。或者避免再次注册窗口类。或者忽略特定的错误代码。