Hi,
I am trying to create an ActiveX control (mediaplayer9.0 to be more
specific) over document/view architecture. The application is created on
VC++6.0 and its working fine.
But as soon as I port the same application from VC++6.0 to VC.Net and tries
to run the application, it gives an error in GetParent() function as this
function checks for ASSERT(::IsWindow(m_hWnd)). m_hWnd handle is assigned
inside CreateControl() call of ActiveX, which is happening perfectly fine
with VC++6.0.
1. I debugged the application in more detail for CreateControl() call in
both VC++6.0 and VC.Net and found that in VC.Net:
a. COleControlSite::XOleIPSite::OnInPlaceActivateEx() function is
getting called and assigning the (mediaplayer) control to be windowless.
In parallel to this VC++6.0 calls:
a. COleControlSite::XOleIPSite::OnInPlaceActivate(), which is doing
nothing but returning "OK".
2. In addition to above inside CreateControl() VC.Net calls:
1. COleControlSite::AttachWindow(), which actually assigns the handle to
“m_hWnd”. This is failing in VC.Net but working perfectly ok with VC++6.0 and
that’s the reason why control is working fine with VC6.0 and not with VC.Net.
Queries:
1. Can anyone let me know why the behavior (which is leading to error) is
changing in VC.Net??
2. Is point (1) defined above is causing failure of point (2) or its because
of some different behavior of VC.Net??
3. Anyone know if there is any change in ActiveX for VC.Net??
I have to use "m_hWnd" handle further in my application.
FYI: .Net/VC7/atlmfc/src/mfc/occsite.cpp (This is the path for
OnInPlaceActivateEx() and AttachWindow() functions).
Thanks,
Ajit