F
Frank
Hi,
I try to host an ActiveX control in a C# and a VB.NET application. I
try to use the concept of Alex Feinman, who has shown, how something
like that works with the windows media player control. The original
sample of Alex Feinman works fine. I try to change this sample so that
I can host my own ActiveX controls. I get several errors. I use AxImp
to get the source code for the wrapperclass of my ActiveX controls.
This file could not be compiled, because of two errors: The code line
System.ComponentModel.DefaultEvent is not valid and the code line
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")] is not valid.
I remove this two lines. Now I can compile my sample app. ( Was it
wrong to remove this two lines?)
Now I want to insert my control from the toolbar in a form of my app. I
got an error while doing this: "Failed to create 'MyControlCtrl'.
'System.InvalidCastException: Unable to cast object of type
'Microsoft.CompactFramework.UnsafeControl' to type
'System.Windows.Forms.AxHost'.
I solve this problem, but I can't remember how. Now I can build my app.
If I run my app on my device, I got an error in line 315 - 317 of
AxHost.cs ( protected virtual void ResizeControl() ) :
IOleWindow wnd = GetOcx() as IOleWindow;
IntPtr hwnd;
wnd.GetWindow(out hwnd);
The problem is that wnd is null. (The return value of GetOcx() is not
null, but GetOcx() as IOleWindow is null.)
How can I solve this problem. I don't think, that the ActiveX control I
want to host is the problem. I tried to host a dummy control, that does
not implement any methods/events, too. I tried to host the controls
with a modification of the original sample and with a new C# app and
with a new VB.nET app. Every time with the same errors.
Frank
I try to host an ActiveX control in a C# and a VB.NET application. I
try to use the concept of Alex Feinman, who has shown, how something
like that works with the windows media player control. The original
sample of Alex Feinman works fine. I try to change this sample so that
I can host my own ActiveX controls. I get several errors. I use AxImp
to get the source code for the wrapperclass of my ActiveX controls.
This file could not be compiled, because of two errors: The code line
System.ComponentModel.DefaultEvent is not valid and the code line
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")] is not valid.
I remove this two lines. Now I can compile my sample app. ( Was it
wrong to remove this two lines?)
Now I want to insert my control from the toolbar in a form of my app. I
got an error while doing this: "Failed to create 'MyControlCtrl'.
'System.InvalidCastException: Unable to cast object of type
'Microsoft.CompactFramework.UnsafeControl' to type
'System.Windows.Forms.AxHost'.
I solve this problem, but I can't remember how. Now I can build my app.
If I run my app on my device, I got an error in line 315 - 317 of
AxHost.cs ( protected virtual void ResizeControl() ) :
IOleWindow wnd = GetOcx() as IOleWindow;
IntPtr hwnd;
wnd.GetWindow(out hwnd);
The problem is that wnd is null. (The return value of GetOcx() is not
null, but GetOcx() as IOleWindow is null.)
How can I solve this problem. I don't think, that the ActiveX control I
want to host is the problem. I tried to host a dummy control, that does
not implement any methods/events, too. I tried to host the controls
with a modification of the original sample and with a new C# app and
with a new VB.nET app. Every time with the same errors.
Frank