Windows Vista 和 Office: 使用托管预览处理程序框架以自己的方式查看数据
2009-02-09 17:43:48 来源:WEB开发网[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")]
interface IPreviewHandler
{
void SetWindow(IntPtr hwnd, ref RECT rect);
void SetRect(ref RECT rect);
void DoPreview();
void Unload();
void SetFocus();
void QueryFocus(out IntPtr phwnd);
[PreserveSig]
uint TranslateAccelerator(ref MSG pmsg);
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("8327b13c-b63f-4b24-9b8a-d010dcc3f599")]
interface IPreviewHandlerVisuals
{
void SetBackgroundColor(COLORREF color);
void SetFont(ref LOGFONT plf);
void SetTextColor(COLORREF color);
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")]
interface IInitializeWithFile
{
void Initialize([MarshalAs(UnmanagedType.LPWStr)] string pszFilePath,
uint grfMode);
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")]
interface IInitializeWithStream
{
void Initialize(IStream pstream, uint grfMode);
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352")]
public interface IObjectWithSite
{
void SetSite([In,MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);
void GetSite(ref Guid riid,
[MarshalAs(UnmanagedType.IUnknown)] out object ppvSite);
}
[ComImport]
[Guid("00000114-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleWindow
{
void GetWindow(out IntPtr phwnd);
void ContextSensitiveHelp(
[MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
}
在我的用于实现预览处理程序的托管框架中,这些接口的大多数功能都包装在一个称为 PreviewHandler 的抽象基类中:
更多精彩
赞助商链接