Previewing Documents In A Managed Application

Previewing Documents In A Managed Application

am 20.07.2007 11:34:47 von Tim Haughton

Hi, I'm trying to implement a preview feature in a managed application to
preview files of arbitrary type. Has anyone done this in a managed app? I've
seen at least one suggestion that you can host prevhost on your form, but
I'm not sure this is correct.

I've seen the IPreviewHandler and IPreviewHandlerFrame interfaces, but
haven't managed to use them from C#. They both live in shobjidl.idl, but
when I create the type library using midl.exe, the key interfaces are
missing.

Can anyone offer any assistance?

Tim

Re: Previewing Documents In A Managed Application

am 20.07.2007 15:21:42 von Jim Barry

Tim Haughton wrote:
> Hi, I'm trying to implement a preview feature in a managed
> application to preview files of arbitrary type. Has anyone done this
> in a managed app? I've seen at least one suggestion that you can host
> prevhost on your form, but I'm not sure this is correct.

I suppose you could, but I think it would be rather hard work. Also, =
preview handlers are new for Vista so it wouldn't be much use on =
previous versions. If you just want a pictorial representation of a =
file, you could show a thumbnail. On Vista, =
IShellItemImageFactory::GetImage makes this very easy. On older Windows =
versions, you can fall back to GetUIObjectOf/IExtractImage.

--=20
Jim Barry, MVP (Windows SDK)

Re: Previewing Documents In A Managed Application

am 20.07.2007 18:04:49 von mvp

Tim,

Why not just declare the interfaces in C# code manually? They are not
that big, and the types are not so complex that it would be very difficult.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Tim Haughton" wrote in message
news:Wk%ni.4682$EM4.1490@fe07.news.easynews.com...
> Hi, I'm trying to implement a preview feature in a managed application to
> preview files of arbitrary type. Has anyone done this in a managed app?
> I've
> seen at least one suggestion that you can host prevhost on your form, but
> I'm not sure this is correct.
>
> I've seen the IPreviewHandler and IPreviewHandlerFrame interfaces, but
> haven't managed to use them from C#. They both live in shobjidl.idl, but
> when I create the type library using midl.exe, the key interfaces are
> missing.
>
> Can anyone offer any assistance?
>
> Tim

Re: Previewing Documents In A Managed Application

am 23.07.2007 10:00:35 von Tim Haughton

Thanks Jim, we already have the IShellItemImage factory stuff in their, but
it's kind of a document management application, so we need the preview stuff
as well - and it's a Vista only app.


Cheers,

Tim

"Jim Barry" wrote in message
news:OL2kpDtyHHA.3940@TK2MSFTNGP05.phx.gbl...
Tim Haughton wrote:
> Hi, I'm trying to implement a preview feature in a managed
> application to preview files of arbitrary type. Has anyone done this
> in a managed app? I've seen at least one suggestion that you can host
> prevhost on your form, but I'm not sure this is correct.

I suppose you could, but I think it would be rather hard work. Also, preview
handlers are new for Vista so it wouldn't be much use on previous versions.
If you just want a pictorial representation of a file, you could show a
thumbnail. On Vista, IShellItemImageFactory::GetImage makes this very easy.
On older Windows versions, you can fall back to GetUIObjectOf/IExtractImage.

Re: Previewing Documents In A Managed Application

am 23.07.2007 10:02:21 von Tim Haughton

Thanks Nicholas, I'm heading that way, so I'll give it a look.

Tim


"Nicholas Paldino [.NET/C# MVP]" wrote in
message news:%23RANxcuyHHA.1176@TK2MSFTNGP05.phx.gbl...
> Tim,
>
> Why not just declare the interfaces in C# code manually? They are not
> that big, and the types are not so complex that it would be very
> difficult.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "Tim Haughton" wrote in message
> news:Wk%ni.4682$EM4.1490@fe07.news.easynews.com...
>> Hi, I'm trying to implement a preview feature in a managed application to
>> preview files of arbitrary type. Has anyone done this in a managed app?
>> I've
>> seen at least one suggestion that you can host prevhost on your form, but
>> I'm not sure this is correct.
>>
>> I've seen the IPreviewHandler and IPreviewHandlerFrame interfaces, but
>> haven't managed to use them from C#. They both live in shobjidl.idl, but
>> when I create the type library using midl.exe, the key interfaces are
>> missing.
>>
>> Can anyone offer any assistance?
>>
>> Tim
>
>