Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Interfaces, prefix the name with the module name and a period.
ITrayDeskband (Interfaces)
.
C# Definition:
[ComImport, Guid("6D67E846-5B9C-4db8-9CBC-DDE12F4254F1"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("6D67E846-5B9C-4db8-9CBC-DDE12F4254F1")]
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();
}
[PreserveSig]
int ShowDeskBand(Guid clsid);
[PreserveSig]
int HideDeskBand(Guid clsid);
[PreserveSig]
int IsDeskBandShown(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);
hr = obj.ShowDeskBand(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.
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.