I use a combination of ATL and WTL for a project and inferred my own class from CWindowImpl, which looks something like this:
class CMyControl : public CWindowImpl<CMyControl>
{
public:
DECLARE_WND_CLASS(_T("MyClassName"))
...
BEGIN_MSG_MAP(CMyControl)
...
END_MSG_MAP()
};
This is good, and if I use CMyControl::Createto create an instance of the control, then it works fine, since under the hood the function CWindowImpl::Createregisters the Win32 class (in this case it is called MyClassName).
However, this behavior - the Win32 class is registered when an instance is created, which causes me a headache. I want to be able to register the class up in order to use the class name with another third-party library that will create this window using a call to Win32 CreateWindowEx, but I cannot find an easy way to do this. Currently, I bypass this using staticas the class name CreateWindowEx, and then use CMyWindow::SubclassWindowto join your class, but it is kludge.
Does anyone know how to register a derived class CWindowImplwithout actually creating a window, so can I successfully pass the class name CreateWindowEx? I would think that there is a standard way to do this with ATL windows, since I cannot be the first to encounter this problem.