Hey,
I'm having problems getting my DeskBand shell extension display it's name
properly. This is happening in the IDeskBand::GetBandInfo method.
It seems like the error is when marshalling the string.
The DESKBANDINFO structure which is used to have this information is defined
in ShObjIdl.idl as:
typedef struct {
DWORD dwMask;
POINTL ptMinSize;
POINTL ptMaxSize;
POINTL ptIntegral;
POINTL ptActual;
WCHAR wszTitle[256];
DWORD dwModeFlags;
COLORREF crBkgnd;
} DESKBANDINFO;
This would've been simple if it was LPWSTR lpszTitle; or something like
that, but I can't get that WCHAR correct.
This is how I've defined the same structure in my code, using C#:
[StructLayout (LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct DeskBandInfo
{
public Int32 dwMask;
public POINTL ptMinSize;
public POINTL ptMaxSize;
public POINTL ptIntegral;
public POINTL ptActual;
[MarshalAs(UnmanagedType.LPWStr, SizeConst=256)] public String wszTitle;
public Int32 dwModeFlags;
public Int32 crBkgnd;
}
POINTL is a structure I've defined too, but that's not important right now.
I've also tried using an array of Char as the wszTitle, but the shell
doesn't like that very much :( and won't even call my IDeskBand::GetBandInfo
method...
So.. does anybody see what I'm doing wrong here? Right now I only get to
small rectangles as the title of my deskband, which isn't correct.
Andreas H�ber
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.