Re: CreateWindowEx AtlAxWin fails with last error 1407
"David Liebtag" <DavidLiebtag@vermontel.net> wrote in message
news:uj5UBJGXIHA.1212@TK2MSFTNGP05.phx.gbl
When I pass a license key to ATL during ActiveX control, I think I
need something more in my DLGINIT structure. I fill in the first 5
members and nothing more, Tracing through the ATL code, I see that
it fails on line 1873 of atlhost.h when it tries to call
IPersistStreamInit->Load to initialize the control. Load returns
E_UNEXPECTED.
Ah, I see the problem. When you pass this extra data to CreateWindow,
ATL machinery assumes it's creating a control previously configured and
saved by Dialog Editor. The data is expected to contain a license key
followed by whatever the control wrote with IPersistStream::Save. So the
machinery insists on calling IPersistStream::Load, even if there's no
more data in the stream (rather than InitView you would rather have it
call).
I don't see any way around this. I'm afraid you will have to do
everything separately after all: create the window, create the control,
then attach control to the window. See KB article KB218442 "How to add
ActiveX controls to an ATL composite control programmatically in Visual
C++".
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925