Re: CWindowImpl-derived classes in dialog boxes
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 04/09/04
- Next message: Alexander Nickolov: "Re: [oledb consumer templates] IUnknown parameter type not supported?"
- Previous message: Alexander Nickolov: "Re: CWindowImpl-derived classes in dialog boxes"
- In reply to: ColdShine: "Re: CWindowImpl-derived classes in dialog boxes"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 9 Apr 2004 00:04:16 -0700
Now I remember what was the principle problem with ATL
for User Controls - its startup windowproc does not allocate
a class instance - it assumes it is created from an existing class
instance. I meant to write an extension that actually manages
its own lifetime so one can write User Controls, but never
got to that...
The solution lies in writing some code in WM_INITDIALOG.
What you do is you place static controls on your dialog, then
you either destroy them after you get their coordinates and
create your controls in their places, or you simply subclass them
using your real control classes and take over everything.
-- ===================================== Alexander Nickolov Microsoft MVP [VC], MCSD email: agnickolov@mvps.org MVP VC FAQ: http://www.mvps.org/vcfaq ===================================== "ColdShine" <coldshine_NO_UNDERSCORES_@hotmail.com> wrote in message news:c5344t$2o8ffm$1@ID-214373.news.uni-berlin.de... > >> So, is there any safe way of creating ATL controls à-là plain SDK? > > > > Are you trying to host a full ATL control? > > > > If so, learn to love CAxWindow and its sibling CAxDialog. There is > > lots of heavy lifting to do in this effort, and CAxWindow does a > > fairly decent job. And if that is not enough, have a look at: > > > > http://www.microsoft.com/msj/1299/Containment/Containment.aspx > > > > I think when you study this, it is not for the faint of heart. And if > > you want to do this without CAxWindow, then I wish you a good summer. > > Uhm, I think that would be shooting a butterfly with a cannon :P > No ActiveX, I only meant a simple ATL control, that is: > > class CMyControl : public CWindowImpl<CMyControl> > { > public: > DECLARE_WND_CLASS(_T("MyControl class")) > > BEGIN_MSG_MAP(CMyControl) > ... > END_MSG_MAP() > }; > > Once I declare such a window class, I'd like to draw a "MyControl class" > control in the dialog designer, but where do I register the class? When? > The Windows code to create a dialog from a resource template invokes > ::CreateWindowEx(), thus _AtlWinModule.AddCreateWndData() is never called > (and of course, the actual class instance is not even allocated); this > surely leads to something bad. > > I wonder if there's any way of meeting the ease of design provided by > resource editor with the ease of coding provided by ATL. > > -- > ColdShine > > "Experience is a hard teacher: she gives the test first, the lesson > afterwards." > - Vernon Sanders law > >
- Next message: Alexander Nickolov: "Re: [oledb consumer templates] IUnknown parameter type not supported?"
- Previous message: Alexander Nickolov: "Re: CWindowImpl-derived classes in dialog boxes"
- In reply to: ColdShine: "Re: CWindowImpl-derived classes in dialog boxes"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|