Re: PreRegister Window class
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 01/28/05
- Next message: Igor Tandetnik: "Re: Focus on control or container"
- Previous message: Alexander Nickolov: "Re: fire event & IUnknown"
- In reply to: Jiju George: "Re: PreRegister Window class"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 09:41:19 -0800
Ah, I hadn't realized why the OP wanted this... Yes, you
are completely right - ATL classes cannot be used for
third party window creation. I had an idea to write my
own version of CWindowImpl that dynamically creates
the class instance when the window is created and then
destroys it when the window is destroyed. It requires
a significant bit of tweaking, including copy/paste of quite
a few ATL classes however... (I've done similar work
to use ATL in a GINA DLL, and I realize this is not the
average programmer's bowl of soup...)
-- ===================================== Alexander Nickolov Microsoft MVP [VC], MCSD email: agnickolov@mvps.org MVP VC FAQ: http://www.mvps.org/vcfaq ===================================== "Jiju George" <jiju.george@gmail.com> wrote in message news:1106883311.647229.170700@z14g2000cwz.googlegroups.com... > If you check the implementation of the CWindowImpl class, then you can > find that CWindowImpl requires the window to be created by calling the > Create() function of CWindoImpl itself. This is because the window > procedure (CWindowImplBaseT::StartWindowProc) of the CWindowImpl > expects some data to be filled in the _Module global object. And you > can see that this data is filled in the Create() function of > CWindowImplBaseT class. So when you register the class using > RegisterClassEx by giving the WNDCLASS of your CWIndowImpl derived > class, your are using CWindowImplBaseT::StartWindowProc function as the > window procedure. So when another process loads your DLL and tries to > create the window using the registerd window class, after creating the > wondow, CWindowImplBaseT::StartWindowProc function will be called. But > at this point, _Module does not have the required data. So it will not > work. You can check this by creating a separate EXE and loading your > DLL and then creating your window using CreateWindow() WIn32 API call > giving your class name. > > I suppose that windows IME manager will also be doing the same > sequence. I.e, loading your IME dll and creating the window using the > window class you returned in the ImeInquire() exported function. If so > then, I am afraid whether you can use ATL CWindowImpl derived classes > to satisfy the requirement. May be you need to use the WIn32 stuff? (I > am not sure.May be some other workaround?) >
- Next message: Igor Tandetnik: "Re: Focus on control or container"
- Previous message: Alexander Nickolov: "Re: fire event & IUnknown"
- In reply to: Jiju George: "Re: PreRegister Window class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|