IainHere
asked on
CWnd derived class in ATL object
I have a control that I've written with MFC, and I would like to make it accessible to VB (and anything else) as an ActiveX control. I knocked out a demo ATL object (never used it before now), but I can't work out how to host my CWnd derived control within the ActiveX control.
Could I have some advice about a strategy to do this - I don't really want detailed example code (although a few pointers would be nice).
Could I have some advice about a strategy to do this - I don't really want detailed example code (although a few pointers would be nice).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK. Using the CEdit method, I want to replace the member control that is the edit with my own control:
CContainedWindow m_ctlEdit;
CMyControl() :
m_ctlEdit(_T("Edit"), this, 1)
{
m_bWindowOnly = TRUE;
}
I guess I replace this code with:
CContainedWindow m_ctlMine; etc...
But how do I get the "LPTSTR lpszClassName" for the CContainedWindow constructor? How do I find out what that is - do I have to register the class with something?
Thanks.
CContainedWindow m_ctlEdit;
CMyControl() :
m_ctlEdit(_T("Edit"), this, 1)
{
m_bWindowOnly = TRUE;
}
I guess I replace this code with:
CContainedWindow m_ctlMine; etc...
But how do I get the "LPTSTR lpszClassName" for the CContainedWindow constructor? How do I find out what that is - do I have to register the class with something?
Thanks.
I'd try just replacing it completely ? eg use CMyWindow rather than CContaindWindow
ASKER
OK, that sounds good, but I need to pass a CWnd* to the Create() function in my control (which is of course passed on to the CWnd::Create() function).
Do you know how I would get that from the control I've made in the way you describe above?
>(this member object is normally replaced by my custom window)
I guess you have this problem too, or do you do something else?
Do you know how I would get that from the control I've made in the way you describe above?
>(this member object is normally replaced by my custom window)
I guess you have this problem too, or do you do something else?
CWindow or CWnd ?? use the HWND and pass that around -
what does your control look like? - just .h file will suffice - it might speed thingsup :)
what does your control look like? - just .h file will suffice - it might speed thingsup :)
ASKER
Thanks for the help Shaun. To be honest, after having spent a bit longer looking at these things, I've decided to write it as an MFC ActiveX control for now.
Perhaps I'll have time to do the ATL thing another day :-)
Perhaps I'll have time to do the ATL thing another day :-)
:)
ASKER
Thanks.