ActiveX controls child window of another ActiveX control
-
Hello all
Are you concerntating? Yes, good. I am wondering it anyone knows the answer to this topic or can point me in the right direction.I'll elaborate upon my query. Thus any replies I get (hopefully), will be answeredin the correct context.
Below are is a sample three controls.- A standalone control (Demo control 1)
- Another standalone control (Demo control 2)
- A meta control which has its own features as well as containing controls (1 & 2 above)
When I build the first two, they both build and register successfully. I can use either (or both) on other projects as child windows. i.e. VC dialogues, VB forms, Delphi Forms. Web pages ect. with no problems.
There seems to be a problem when ActiveX control is a parent.
The nature of my query is this: how can achieve no3 (meta control) Without it causing crashes when I insert it into other projects (or the test container)Step by step to what I did to create number 3:
-
I've designed a control for called CMetaCtrrl via AppWizard
-
Inserted both Demo1 and Demo2 ActiveX controls into the project with their wrapper classes generated
-
Added a member 'variables' to both
-
Inserted the handler WM_CREATE (that's what you have to do if you're using child windows)
-
Inside the function OnCreate. I've added code to allow creation of the children windows
CRect rcInit(CPoint(0), CPoint(0)); m_demo1.CreateControl(m_demo1.GetClsid(), "", WS_CHILD | WS_VISIBLE, rcInit, this, 1001); m_demo2.CreateControl(m_demo2.GetClsid(), "", WS_CHILD | WS_VISIBLE, rcInit, this, 1002);
-
Added code to position and make Demo controls 1 & 2 visible
-
Built the project (Which it does successfully) also favourably accomplished is the registration of the control.
That done I test newly created control. It's when I insert that's when the troubles start. When using the test container it raises an execption, or on placement of the control on a form (or dialogue) the same things happens. In addition to that it brings down whatever development tool I'm using. The problem is occurring when an attempt is made to create the first chold window.
On debugging I've stepped into m_demo1.CreateControl().
Which leads me to step intoAFX_MODULE_STATE* AFXAPI AfxGetModuleState()
-
Hello all
Are you concerntating? Yes, good. I am wondering it anyone knows the answer to this topic or can point me in the right direction.I'll elaborate upon my query. Thus any replies I get (hopefully), will be answeredin the correct context.
Below are is a sample three controls.- A standalone control (Demo control 1)
- Another standalone control (Demo control 2)
- A meta control which has its own features as well as containing controls (1 & 2 above)
When I build the first two, they both build and register successfully. I can use either (or both) on other projects as child windows. i.e. VC dialogues, VB forms, Delphi Forms. Web pages ect. with no problems.
There seems to be a problem when ActiveX control is a parent.
The nature of my query is this: how can achieve no3 (meta control) Without it causing crashes when I insert it into other projects (or the test container)Step by step to what I did to create number 3:
-
I've designed a control for called CMetaCtrrl via AppWizard
-
Inserted both Demo1 and Demo2 ActiveX controls into the project with their wrapper classes generated
-
Added a member 'variables' to both
-
Inserted the handler WM_CREATE (that's what you have to do if you're using child windows)
-
Inside the function OnCreate. I've added code to allow creation of the children windows
CRect rcInit(CPoint(0), CPoint(0)); m_demo1.CreateControl(m_demo1.GetClsid(), "", WS_CHILD | WS_VISIBLE, rcInit, this, 1001); m_demo2.CreateControl(m_demo2.GetClsid(), "", WS_CHILD | WS_VISIBLE, rcInit, this, 1002);
-
Added code to position and make Demo controls 1 & 2 visible
-
Built the project (Which it does successfully) also favourably accomplished is the registration of the control.
That done I test newly created control. It's when I insert that's when the troubles start. When using the test container it raises an execption, or on placement of the control on a form (or dialogue) the same things happens. In addition to that it brings down whatever development tool I'm using. The problem is occurring when an attempt is made to create the first chold window.
On debugging I've stepped into m_demo1.CreateControl().
Which leads me to step intoAFX_MODULE_STATE* AFXAPI AfxGetModuleState()
-
Hi Alton Sounds like you've forgotten to add the following to the beginning of your control:
void AfxEnableControlContainer( );
You can't contain a control without it TomThanks Tom:) I've been asking this question since May:(( enven done a google search. But, received no joy. Question where do place
TClarke wrote:
void AfxEnableControlContainer( );
Gratefully Alton:):-D:-D
-
Thanks Tom:) I've been asking this question since May:(( enven done a google search. But, received no joy. Question where do place
TClarke wrote:
void AfxEnableControlContainer( );
Gratefully Alton:):-D:-D