G
Guest
Hi everyone,
I have a C# based COM DLL that uses an old ocx. The ocx is placed within a
panel inside a form that the C# COM DLL displays as a dialog.
In the InitializeComponent call, I get the "Call is rejected by callee"
exception with the EndInit call on the ocx wrapper.
Here are the relevant portions of the code:
namespace KVXUI
{
public class KVXUIForm : System.Windows.Forms.Form
{
....
private AxKVXLib.AxKVX m_kvx;
....
public KVXUIForm()
{
InitializeComponent();
....
}
private void InitializeComponent()
{
....
this.m_kvx = new AxKVXLib.AxKVX();
....
((System.ComponentModel.ISupportInitialize)(this.m_kvx)).BeginInit();
....
m_MainPanel.Controls.Add(this.m_kvx);
....
//
// m_kvx
//
.... m_kvx initialization code here
....
((System.ComponentModel.ISupportInitialize)(this.m_kvx)).EndInit();
....
}
....
}
}
The exception occurs when the EndInit shown above is called. However, this
does not happen always. Here are a couple of scenarios showing how the DLL is
invoked:
The following scenario works fine.
MFC app --> some other ocx --> ATL COM object --> my C# COM DLL
The scenario below results in an exception.
Adobe Acrobat 5.0 -> some other dll -> ATL COM object -> my C# COM DLL
There were some posts on the net that indicated that this may be a timing
related problem. I sprinkled some sleep calls but that didn't help.
Any help will be greatly appreciated.
Thanks.
Hari
I have a C# based COM DLL that uses an old ocx. The ocx is placed within a
panel inside a form that the C# COM DLL displays as a dialog.
In the InitializeComponent call, I get the "Call is rejected by callee"
exception with the EndInit call on the ocx wrapper.
Here are the relevant portions of the code:
namespace KVXUI
{
public class KVXUIForm : System.Windows.Forms.Form
{
....
private AxKVXLib.AxKVX m_kvx;
....
public KVXUIForm()
{
InitializeComponent();
....
}
private void InitializeComponent()
{
....
this.m_kvx = new AxKVXLib.AxKVX();
....
((System.ComponentModel.ISupportInitialize)(this.m_kvx)).BeginInit();
....
m_MainPanel.Controls.Add(this.m_kvx);
....
//
// m_kvx
//
.... m_kvx initialization code here
....
((System.ComponentModel.ISupportInitialize)(this.m_kvx)).EndInit();
....
}
....
}
}
The exception occurs when the EndInit shown above is called. However, this
does not happen always. Here are a couple of scenarios showing how the DLL is
invoked:
The following scenario works fine.
MFC app --> some other ocx --> ATL COM object --> my C# COM DLL
The scenario below results in an exception.
Adobe Acrobat 5.0 -> some other dll -> ATL COM object -> my C# COM DLL
There were some posts on the net that indicated that this may be a timing
related problem. I sprinkled some sleep calls but that didn't help.
Any help will be greatly appreciated.
Thanks.
Hari