How to create ocx within another ocx in the same .ocx file 
Author Message
 How to create ocx within another ocx in the same .ocx file

I am trying to make use of ocx controls within another ocx. I have
successfully done this
if the containing ocx is in a separate .ocx file. However, when I try to
put the containing ocx
and contained ocx into the same project(therefore they are residing in the
same .ocx), the
creation of the contained ocx fails, because Windows thinks that the
conatined ocx is
already in the permanant map, therefore, refuse to attach the newly created
handle to the
control object.

Here is my control creation code
        if ( m_pBindTree->CreateControl( _T("POINTCTRL.CtlBindtreeCtrl.1"),
                        WS_CHILD | WS_VISIBLE, rect, this, IDC_BINDTREE ) )
                return -1;

Here is where the assertion happens

        BOOL CWnd::Attach(HWND hWndNew)
                        ASSERT(m_hWnd == NULL);     // only attach once, detach on destroy
failed here >>>>>        ASSERT(FromHandlePermanent(hWndNew) == NULL);
                        // must not already be in permanent map

                if (hWndNew == NULL)
                        return FALSE;

                CHandleMap* pMap = afxMapHWND(TRUE); // create map if not exist
                ASSERT(pMap != NULL);

                pMap->SetPermanent(m_hWnd = hWndNew, this);

        #ifndef _AFX_NO_OCC_SUPPORT

                return TRUE;

Would someone please enlight me on where my code went wrong? Your early
is highly appreciated. Please send your response to




Fri, 14 Jan 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. OCX within another OCX??

2. Need urgent help for OCX and Visual C++ (MSINET.OCX)

3. Need urgent help for OCX and Visual C++ (MSINET.OCX)

4. Loading an OCX into my OCX's window

5. About use ocx in program ocx?

6. regsvr32 crash when registering OCX - Loading dlls dynamically from OCX's

7. Need urgent help for OCX and Visual C++ (MSINET.OCX)

8. build a ocx around a ocx

9. Help! OCX containing OCX broken by IE4

10. Wanted: Good schedule OCX or gant OCX

11. OCX Control In an OCX Controll

12. OCX: Installing an OCX control


Powered by phpBB® Forum Software