是否有Windows 7的预览处理程序VCL? [英] Is there a Preview Handler VCL for Windows 7?

查看:411
本文介绍了是否有Windows 7的预览处理程序VCL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这篇文章

http://msdn.microsoft.com/en-gb/library/bb776867.aspx

描述Windows中的预览处理程序为

describes preview handlers in Windows as



项目被选中显示
轻量级,丰富的只读预览
时,调用预处理程序视图的
阅读窗格中的文件内容。没有
启动文件关联的
应用程序,这是完成的。

Preview handlers are called when an item is selected to show a lightweight, rich, read-only preview of the file's contents in the view's reading pane. This is done without launching the file's associated application.

和...


预览处理程序是托管的
应用程序。主机包括Windows
Vista或Microsoft Outlook 2007中的
Microsoft Windows资源管理器。

A preview handler is a hosted application. Hosts include the Microsoft Windows Explorer in Windows Vista or Microsoft Outlook 2007.

是否有一些Delphi VCL代码可以用作这样的处理程序的起点?

Is there some Delphi VCL code which can be used as a startingpoint for such a handler?

推荐答案

@Mjn,对,知道我写一篇文章我的博客从Delphi实现预览处理程序,但由于缺乏时间,我不知道这是完成的正如其他用户目前提到的,Delphi中没有VCL组件来实现预览处理程序,以前我为客户实现了一些预览处理程序,但是使用Delphi-Prism和C#。

@Mjn, right know i'am writing an article for my blog to implement Preview Handlers from Delp but due to lack of time, I do not know when this is complete, as others users mention by the moment no exist a VCL component in Delphi to implement preview handlers, in the past i implement a couple of preview handlers for a customer but using Delphi-Prism and C#.

作为起点,如果你想开始你自己的项目,这里我留下一些提示。

as starting point if you wanna start your own project, here i leave some tips.

  • You must use the IPreviewHandler, InitializeWithFile, InitializeWithStream, IPreviewHandlerFrame, IPreviewHandlerVisuals interfaces.

这是这些接口的标头的delphi翻译

this is the delphi translation of the headers of these interfaces

uses
  Windows, ActiveX, AxCtrls, ShlObj, ComObj;

type


  IIPreviewHandler = interface(IUnknown)
    ['{8895b1c6-b41f-4c1c-a562-0d564250836f}']
    function SetWindow(hwnd: HWND; var RectangleRef: TRect): HRESULT; stdcall;
    function SetRect(var RectangleRef: TRect): HRESULT; stdcall;
    function DoPreview(): HRESULT; stdcall;
    function Unload(): HRESULT; stdcall;
    function SetFocus(): HRESULT; stdcall;
    function QueryFocus(phwnd: HWND): HRESULT; stdcall;
    function TranslateAccelerator(PointerToWindowMessage: MSG): HRESULT; stdcall;
  end;

  IInitializeWithFile = interface(IUnknown)
    ['{b7d14566-0509-4cce-a71f-0a554233bd9b}']
    function Initialize(pszFilePath: LPWSTR; grfMode: DWORD):HRESULT;stdcall;
  end;

  IInitializeWithStream = interface(IUnknown)
    ['{b824b49d-22ac-4161-ac8a-9916e8fa3f7f}']
    function Initialize(pstream: IStream; grfMode: DWORD): HRESULT; stdcall;
  end;

  IIPreviewHandlerFrame = interface(IUnknown)
    ['{fec87aaf-35f9-447a-adb7-20234491401a}']
    function GetWindowContext(pinfo: HWND): HRESULT; stdcall;
    function TranslateAccelerator(PointerToWindowMessage: MSG): HRESULT; stdcall;
  end;

  IIPreviewHandlerVisuals = interface(IUnknown)
    ['{8327b13c-b63f-4b24-9b8a-d010dcc3f599}']
        function SetBackgroundColor(color: COLORREF ): HRESULT; stdcall;
        function SetFont(plf:LOGFONTW): HRESULT; stdcall;  
        function SetTextColor(color: COLORREF): HRESULT; stdcall;
  end;




  • 您必须使用从这些界面下降的类创建一个com dll IIPreviewHandler,IIPreviewHandlerVisuals,IOleWindow,IObjectWithSite来管理可视化,第二个类加载要显示的文件。这个类必须从 IPreviewHandler IInitializeWithStream 下降。

    • you must create a com dll with a class which descend from these interfaces IIPreviewHandler, IIPreviewHandlerVisuals, IOleWindow, IObjectWithSite to manage the visualization and a second class to load the files to show. this class must descend from IPreviewHandler, IInitializeWithStream.
    • 这样的事情

        TMyPreviewHandler = class(IIPreviewHandler, IIPreviewHandlerVisuals, IOleWindow, IObjectWithSite)
      
        TMyStream = class(IIPreviewHandler, IInitializeWithStream, IStream)
      




      • 现在您必须创建自己的父接口方法的实现。
        这是您需要实现的方法的列表。

        • now you must create your own implementation of the methods for the parent interfaces. this is the list of the methods which you need implement.

          IPreviewHandler - > DoPreview,SetWindow,SetRect,Unload,SetFocus ,TranslateAccelerator,QueryFocus。

          IPreviewHandler -> DoPreview, SetWindow, SetRect, Unload, SetFocus, TranslateAccelerator, QueryFocus.

          IObjectWithSite - > GetSite,SetSite。

          IObjectWithSite -> GetSite, SetSite.

          strong> IOleWindow - > GetWindow

          IOleWindow -> GetWindow

          IPreviewHandlerVisuals - > SetBackgroundColor,SetFont,SetColor

          IPreviewHandlerVisuals - > SetBackgroundColor, SetFont, SetColor

          InitializeWithStream - >初始化

          最后,您必须在系统中注册您的com以及文件扩展名将使用您的PrevieHandler类。

          finally you must register your com in the system as well as the file extensions which will use you PrevieHandler class.

          将此项目作为起点 Windows预览处理程序包 (以C#编写)和本文 使用我们的管理预览处理程序查看数据ork

          check this project as a starting point Windows Preview Handler Pack (is written in C#) and this article View Data Your Way With Our Managed Preview Handler Framework

          这篇关于是否有Windows 7的预览处理程序VCL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆