Implementing IDeskband2

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a working deskband and am trying to implement the IDeskBand2 interface. I keep getting "The [My deskband name] toolbar isnt compatible with this version of Windows" message when enabling the deskband.<br/>
I have tried suggestions that I have found on MSDN, pinvoke, and other sites but none of them resolved the issue.<br/>
References:<br/>
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762064(v=vs.85).aspx<br/>
http://www.pinvoke.net/default.aspx/Interfaces.IDeskBand2<br/>
http://social.msdn.microsoft.com/Forums/eu/clr/thread/a5e756a4-89a9-4afb-8ce4-0c572fba6eaf<br/>
http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/dbbc671d-2f60-4bed-9cff-b915d0fbddbc
My current implementation is:
<pre class="prettyprint [ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsUnknown)] //Other solutions show this as InterfaceIsDual
[Guid("79D16DE4-ABEE-4021-8D9D-9169B261D657")]
public interface IDeskBand2 : IDeskBand
{
void CanRenderComposited(out bool pfCanRenderComposited); //have also tried ref and [Out]
void GetCompositionState(out bool pfCompositionEnabled);
void SetCompositionState([MarshalAs(UnmanagedType.Bool)] bool fCompositionEnabled);
//Some resources say the order should be Can,Set,Get. Changing the order didnt help
}

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("EB0FE172-1A3A-11D0-89B3-00A0C90A90AC")]
public interface IDeskBand //: IOleWindow, IDockingWindow //Did not work if I simply tried to inherit IOleWindow and IDockingWindow
{
void GetWindow(out System.IntPtr phwnd);
void ContextSensitiveHelp([In] bool fEnterMode);
void ShowDW([In] bool fShow);
void CloseDW([In] UInt32 dwReserved);
void ResizeBorderDW(IntPtr prcBorder,[In, MarshalAs(UnmanagedType.IUnknown)] Object punkToolbarSite,bool fReserved);
void GetBandInfo(UInt32 dwBandID,UInt32 dwViewMode,ref DESKBANDINFO pdbi);
}


[ComVisible(true)]
[Guid("318A902F-F919-4554-8297-D50115D14BA9")]
[BandObject("WinForm Banner", BandObjectStyle.TaskbarToolBar, HelpText = "WinForm Banner")]
public partial class SecBanner : UserControl, IObjectWithSite, IDeskBand2/*, IDeskBand*/, IDockingWindow, IOleWindow, IInputObject, IPersistStream
{
///....

#region IDeskband2
private bool _compositionEnabled = true;
public void CanRenderComposited(out bool pfCanRenderComposited)
{
pfCanRenderComposited = true;
}

public void SetCompositionState([MarshalAs(UnmanagedType.Bool)]bool fCompositionEnabled)
{
_compositionEnabled = fCompositionEnabled;
}

public void GetCompositionState(out bool pfCompositionEnabled)
{
pfCompositionEnabled = _compositionEnabled;
}
#endregion IDeskband2
//...
}[/code]
<br/>
Any help would be appreciated. Thanks.

View the full article
 
Back
Top