ATL equivalent of MFCs PreCreateWindow
-
Hi, First let me thank codeproject.com for these excellent forums. I have an MFC-based control which uses PreCreateWindow to specify the class for the new controls window. Job is accomplished in 2 lines of code. I'm hoping that it is that easy in ATL. I've been learning as I go and perhaps (hopefully) it is easy. Any pointers or code samples would be appreciated.
-
Hi, First let me thank codeproject.com for these excellent forums. I have an MFC-based control which uses PreCreateWindow to specify the class for the new controls window. Job is accomplished in 2 lines of code. I'm hoping that it is that easy in ATL. I've been learning as I go and perhaps (hopefully) it is easy. Any pointers or code samples would be appreciated.
In your CWindowImpl-derived class, use the DECLARE_WND_CLASS macro to set the window class name. Eg:
class CMyControl : public CWindowImpl<CMyControl> /*other base classes...*/
{
...
DECLARE_WND_CLASS("MyATLControl")
};--Mike-- http://home.inreach.com/mdunn/ All your base are belong to ME~!
-
In your CWindowImpl-derived class, use the DECLARE_WND_CLASS macro to set the window class name. Eg:
class CMyControl : public CWindowImpl<CMyControl> /*other base classes...*/
{
...
DECLARE_WND_CLASS("MyATLControl")
};--Mike-- http://home.inreach.com/mdunn/ All your base are belong to ME~!
I don't think this is correct. DECLARE_WND_CLASS gives the name of the new class. I want something more like DECLARE_WND_SUPERCLASS(), which seems to provide a mechanism for having both my class and the base class get messages. But I haven't found a real (meaning complete) example of using this. My ATL Wizard generated code has nothing like "class CMyControl : public CWindowImpl " in it.
-
I don't think this is correct. DECLARE_WND_CLASS gives the name of the new class. I want something more like DECLARE_WND_SUPERCLASS(), which seems to provide a mechanism for having both my class and the base class get messages. But I haven't found a real (meaning complete) example of using this. My ATL Wizard generated code has nothing like "class CMyControl : public CWindowImpl " in it.
I think I'm following this thread correctly. Have you tried using my CWindowImpl ATL Object Wizard? By setting a few items on the custom property page for the wizard you can get the desired effect I think you are looking for. http://www.codeproject.com/atl/RBCWindowImpl.asp Cheers, -Erik
-
I think I'm following this thread correctly. Have you tried using my CWindowImpl ATL Object Wizard? By setting a few items on the custom property page for the wizard you can get the desired effect I think you are looking for. http://www.codeproject.com/atl/RBCWindowImpl.asp Cheers, -Erik
Hi Erik, I saw your wizard while perusing codeproject.com . It looks applicable but I haven't had an opportunity to try it out yet. Thanks.