15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Manually enabling OLE control contaiment problem

=?ISO-8859-1?Q?Guillermo_G=F3mez_Valc=E1rcel?= -- guille@baratz.es
Tuesday, November 26, 1996

Environment: VC++ 4.2b, Windows 95, Win NT 3.51

I have enabled OLE control contaiment from Component Gallery and it has
added in InitInstance() function the following line:
	AfxEnableControlContainer()
and in stdafx.h:
	#include .
After this, I have inserted OLE controls in a dialog associated to a clas=
s
derived from CFormView in an MFC/MDI environment.
When a debug version is executed, MFC LoadFrame function displays a messa=
ge
box with the message:
"Unhandled exception in App.exe (MFC042D.DLL):0xC0000005 AccessViolation"
and go to Occmgr.cpp, line 224 that says:

	// No OLE controls were found, so there's no reason to go any further.
	if (!bHasOleControls)
	{
		ppOleDlgItems[0] =3D (DLGITEMTEMPLATE*)(-1);
		return NULL;
	}
My dialog with OLE controls has not been opened yet.
I saw dialog based samples that work fine but not with template
architecture.
This is my source:

BOOL CDockApp::InitInstance()
{
	AfxEnableControlContainer();
=09
	Enable3dControls();
   	SetRegistryKey("DockApp");

	LoadStdProfileSettings();  // Load standard INI file options (including
MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CMultiDocTemplate* pDocTemplate;
	pDocTemplate =3D new CMultiDocTemplate(
		IDR_DOCKTETYPE,
		RUNTIME_CLASS(CDockDoc),
		RUNTIME_CLASS(CDockChildWnd),          // standard MDI child frame
		RUNTIME_CLASS(CDocktestView));
	AddDocTemplate(pDocTemplate);

=09
	//    READERS.

	pDocTemplate =3D new CMultiDocTemplate(
		IDD_SC010,
		RUNTIME_CLASS(CDockDoc),
		RUNTIME_CLASS(CDockChildWnd),        // standard MDI child frame
		RUNTIME_CLASS(CSc010vw)); // dialog with OLE controls
	AddDocTemplate(pDocTemplate);

=09
	// create main MDI Frame window
	CMainFrame* pMainFrame =3D new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) // FAILS
		return FALSE;
	m_pMainWnd =3D pMainFrame;

........
}

Could anybody please explain me the cause of this problem?

Thanks in advance.

Guillermo G=F3mez Valc=E1rcel
Baratz, Servicios de Teledocumentaci=F3n S.A.
guille@baratz.es
http://www.baratz.es=20





Robert Somrek -- Robert.Somrek@noaa.gov
Thursday, November 28, 1996


     As I understand your problem, I believe I have just solved a similar=
  =

     problem for myself tonight. Apparently you need the license key for =

     OLE controls that were imported from the Component Gallery and creat=
ed =

     dynamically in your application. There are two articles in the KB =

     which address and solve this problem. See
       Q151804 PRB: Dynamic Creation of Redistributable Control Fails
     and
       Q151771 LICREQST.EXE: Sample Requesting a License Key from an Obje=
ct
     =

     Good luck.
     =

     Bob Somrek
     National Weather Service Chicago
     robert.somrek@noaa.gov
     =

             =


______________________________ Reply Separator __________________________=
_______
Subject: Manually enabling OLE control contaiment problem
Author:  guille@baratz.es at EXTERNAL
Date:    11/27/96 9:05 PM


Environment: VC++ 4.2b, Windows 95, Win NT 3.51
     =

I have enabled OLE control contaiment from Component Gallery and it has =

added in InitInstance() function the following line:
     AfxEnableControlContainer()
and in stdafx.h:
     #include .
After this, I have inserted OLE controls in a dialog associated to a clas=
s =

derived from CFormView in an MFC/MDI environment.
When a debug version is executed, MFC LoadFrame function displays a messa=
ge =

box with the message:
"Unhandled exception in App.exe (MFC042D.DLL):0xC0000005 AccessViolation"=
 =

and go to Occmgr.cpp, line 224 that says:
     =

     // No OLE controls were found, so there's no reason to go any furthe=
r. =

     if (!bHasOleControls)
     {
          ppOleDlgItems[0] =3D (DLGITEMTEMPLATE*)(-1); =

          return NULL;
     }
My dialog with OLE controls has not been opened yet.
I saw dialog based samples that work fine but not with template =

architecture.
This is my source:
     =

BOOL CDockApp::InitInstance()
{
     AfxEnableControlContainer();
     =

     Enable3dControls();
        SetRegistryKey("DockApp");
     =

     LoadStdProfileSettings();  // Load standard INI file options (includ=
ing
MRU)
     =

     // Register the application's document templates.  Document template=
s =

     //  serve as the connection between documents, frame windows and vie=
ws.
     =

     CMultiDocTemplate* pDocTemplate;
     pDocTemplate =3D new CMultiDocTemplate(
          IDR_DOCKTETYPE,
          RUNTIME_CLASS(CDockDoc),
          RUNTIME_CLASS(CDockChildWnd),          // standard MDI child fr=
ame =

          RUNTIME_CLASS(CDocktestView));
     AddDocTemplate(pDocTemplate);
     =

     =

     //    READERS.
     =

     pDocTemplate =3D new CMultiDocTemplate(
          IDD_SC010,
          RUNTIME_CLASS(CDockDoc),
          RUNTIME_CLASS(CDockChildWnd),        // standard MDI child fram=
e =

          RUNTIME_CLASS(CSc010vw)); // dialog with OLE controls
     AddDocTemplate(pDocTemplate);
     =

     =

     // create main MDI Frame window
     CMainFrame* pMainFrame =3D new CMainFrame;
     if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) // FAILS
          return FALSE;
     m_pMainWnd =3D pMainFrame;
     =

=2E.......
}
     =

Could anybody please explain me the cause of this problem?
     =

Thanks in advance.
     =

Guillermo G=F3mez Valc=E1rcel
Baratz, Servicios de Teledocumentaci=F3n S.A. =

guille@baratz.es
http://www.baratz.es



Chas Woodfield -- cwoodfie@fdgroup.co.uk
Thursday, November 28, 1996


Environment: VC++ 4.2b, Windows 95, Win NT 4.0 Service Pack 1

I believe you may be using the objective toolkit v1.1 from stingray as i   
    

had the same problem, after debugging i found the definition of the class   
    

COccManager in sbardlg.cpp was incorrect. Stingray have implemented their   
    

own version of this class, but had not taken account of it changing
between 4.1 and 4.2 of the mfc.

I found the equivalent definition in the mfc source (occimpl.h) and
copied it in, recompiled the stingray source and everything worked fine.

Hope this helps.

Chas.
cwoodfie@fdgroup.co.uk

 ----------
From:  owner-mfc-l
Sent:  Tuesday, November 26, 1996 4:45 PM
To:  mfc-l
Subject:  Manually enabling OLE control contaiment problem

Environment: VC++ 4.2b, Windows 95, Win NT 3.51

I have enabled OLE control contaiment from Component Gallery and it has
added in InitInstance() function the following line:
        AfxEnableControlContainer()
and in stdafx.h:
        #include .
After this, I have inserted OLE controls in a dialog associated to a
class
derived from CFormView in an MFC/MDI environment.
When a debug version is executed, MFC LoadFrame function displays a
message
box with the message:
"Unhandled exception in App.exe (MFC042D.DLL):0xC0000005 AccessViolation"
and go to Occmgr.cpp, line 224 that says:

        // No OLE controls were found, so there's no reason to go any
further.
        if (!bHasOleControls)
        {
                ppOleDlgItems[0] = (DLGITEMTEMPLATE*)(-1);
                return NULL;
        }
My dialog with OLE controls has not been opened yet.
I saw dialog based samples that work fine but not with template
architecture.
This is my source:

BOOL CDockApp::InitInstance()
{
        AfxEnableControlContainer();
        Enable3dControls();
        SetRegistryKey("DockApp");

        LoadStdProfileSettings();  // Load standard INI file options
(including MRU)

        // Register the application's document templates.  Document
templates
        //  serve as the connection between documents, frame windows and
views.

        CMultiDocTemplate* pDocTemplate;
        pDocTemplate = new CMultiDocTemplate(
                IDR_DOCKTETYPE,
                RUNTIME_CLASS(CDockDoc),
                RUNTIME_CLASS(CDockChildWnd),          // standard MDI
child frame
                RUNTIME_CLASS(CDocktestView));
        AddDocTemplate(pDocTemplate);

        //    READERS.

        pDocTemplate = new CMultiDocTemplate(
                IDD_SC010,
                RUNTIME_CLASS(CDockDoc),
                RUNTIME_CLASS(CDockChildWnd),        // standard MDI
child frame
                RUNTIME_CLASS(CSc010vw)); // dialog with OLE controls
        AddDocTemplate(pDocTemplate);

        // create main MDI Frame window
        CMainFrame* pMainFrame = new CMainFrame;
        if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) // FAILS
                return FALSE;
        m_pMainWnd = pMainFrame;

........
}

Could anybody please explain me the cause of this problem?

Thanks in advance.

Guillermo Gmez Valcrcel
Baratz, Servicios de Teledocumentacin S.A.
guille@baratz.es
http://www.baratz.es




| Вернуться в корень Архива |