Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

ITrayDeskband (Interfaces)
 
.
Summary
Exposes methods that show, hide, and query deskbands.

C# Definition:

    [ComImport, Guid("6D67E846-5B9C-4db8-9CBC-DDE12F4254F1"),
     InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ITrayDeskband
    {
      [PreserveSig]
      int ShowDeskBand([In, MarshalAs(UnmanagedType.Struct)] ref Guid clsid);
      [PreserveSig]
      int HideDeskBand([In, MarshalAs(UnmanagedType.Struct)] ref Guid clsid);
      [PreserveSig]
      int IsDeskBandShown([In, MarshalAs(UnmanagedType.Struct)] ref Guid clsid);
      [PreserveSig]
      int DeskBandRegistrationChanged();
    }

VB Definition:

<ComImport> _
<Guid("TODO")> _
'TODO: Insert <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ if this doesn't derive from IDispatch
Interface ITrayDeskband
   TODO
End Interface

Sample-Code:

    ITrayDeskband obj = null;
    Type trayDeskbandType = System.Type.GetTypeFromCLSID(new Guid("E6442437-6C68-4f52-94DD-2CFED267EFB9"));
    try
    {
        obj = (ITrayDeskband)Activator.CreateInstance(trayDeskbandType);
        Guid deskbandGuid = {SomeDeskbandGuid}
        obj.DeskBandRegistrationChanged();
        hr = obj.ShowDeskBand(ref deskbandGuid);
        if (hr != 0)
            throw new Exception("Error while trying to show deskband: " + hr);
        obj.DeskBandRegistrationChanged();
    }
    catch (Exception e)
    {
        MessageBox.Show(e.Message);
    }
    finally
    {
        if (obj != null && Marshal.IsComObject(obj))
            Marshal.ReleaseComObject(obj);
    }

Notes:

Guid {E6442437-6C68-4f52-94DD-2CFED267EFB9} leads to the correct TrayDeskband object.

* Modified the interface for the COM, I don't know much about it but that's what got it to work for me. The [In, MarshalAs(UnmanagedType.Struct)] may be unnecessary but the 'ref' keyword in the interface and when passing in the variable made it work otherwise I got a corrupt memory pointer exception message.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions