Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ActiveX controls child window of another ActiveX control

ActiveX controls child window of another ActiveX control

Scheduled Pinned Locked Moved C / C++ / MFC
delphidatabasecomdockerhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alton Williams
    wrote on last edited by
    #1

    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.

    1. A standalone control (Demo control 1)
    2. Another standalone control (Demo control 2)
    3. 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 into AFX_MODULE_STATE* AFXAPI AfxGetModuleState()

    T 1 Reply Last reply
    0
    • A Alton Williams

      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.

      1. A standalone control (Demo control 1)
      2. Another standalone control (Demo control 2)
      3. 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 into AFX_MODULE_STATE* AFXAPI AfxGetModuleState()

      T Offline
      T Offline
      TClarke
      wrote on last edited by
      #2

      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 Tom

      A 1 Reply Last reply
      0
      • T TClarke

        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 Tom

        A Offline
        A Offline
        Alton Williams
        wrote on last edited by
        #3

        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

        T 1 Reply Last reply
        0
        • A Alton Williams

          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

          T Offline
          T Offline
          TClarke
          wrote on last edited by
          #4

          Hi Alton Glad I could help :) Personally, I put it into my InitInstance method or as near to the POE as possible. Doesn't really matter though, as long as it's called before you attempt to embed your object. Tom PS, thanks for the feedback :-D

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups