Control supporting Windowless mode.
Hello.
I need to create COM object that support
IOleInPlaceObjectWindowless
System.Windows.Forms.Control doesn't support this interface. That's why i decide to implement similar control that can be activated in windowless mode. I uses
using Microsoft.VisualStudio.OLE.Interop;
library that contain IOle interfaces.
[
Guid("66F34D16-6DCC-42d6-B7CF-788216B72C0F")][
ClassInterface(ClassInterfaceType.None)][
ComDefaultInterface(typeof(IMyControl))]publicpartialclassMyControl:
Component,
IMyControl,
IOleObject{public MyControl(){
InitializeComponent();
.....
publicint GetUserType(uint dwFormOfType,IntPtr userType){
if (dwFormOfType == 1){
userType =
Marshal.StringToHGlobalAnsi(GetType().FullName);}
else{
userType =
Marshal.StringToHGlobalAnsi( GetType().Name );}
return 0;}
.....
}
When I tried to insert this control in tstcon32 application during calling first function GetUserType() this app crashed...
Where I mistaked?..
Maybe other way of creating Windowless control in .NET is exist...

