Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ?

21 views
Skip to first unread message

R.Wieser

unread,
Jan 14, 2022, 4:39:46 AM1/14/22
to
Hello all,

I would like to automate "preview.preview" ("windows picture and fax
viewer", shimgvw) so I have control over what the "next" and "previous"
images are.

In my case I just want to select a few images, possibly not even directly
following each other, outof a folders worth, and cycle thru only them.


I've found the objects typelib and are able to instanciate an object I'm
currently not even able to make an image appear on the screen (the
"ShowFile" method doesn't quite do what it seems to stand for ...)

Regards,
Rudy Wieser


JJ

unread,
Jan 14, 2022, 7:01:35 AM1/14/22
to
Use `ActiveX Control Test Container` tool (TXTCON32.EXE) from Visual Studio
2005 or older versions, to test and play with an ActiveX control. It's
available since VS6. Third party ActiveX tester tool may also be available.

R.Wieser

unread,
Jan 14, 2022, 2:24:36 PM1/14/22
to
JJ,


> Use `ActiveX Control Test Container` tool (TXTCON32.EXE) from Visual
> Studio 2005 or older versions, to test and play with an ActiveX control.

I would have to google for that, but how would that allow me to play better
with it as I can currently do using VBScript ?

Regards,
Rudy Wieser

P.s.
I've dumped its typelib, which is how I know of the available methods.


JJ

unread,
Jan 15, 2022, 3:26:50 PM1/15/22
to
On Fri, 14 Jan 2022 20:24:17 +0100, R.Wieser wrote:
>
> I would have to google for that, but how would that allow me to play better
> with it as I can currently do using VBScript ?
>
> Regards,
> Rudy Wieser
>
> P.s.
> I've dumped its typelib, which is how I know of the available methods.

The tool simply helps us to find out how to use undocumented ActiveX
controls by trials and errors, easily. Without writing a code which may have
an error and causes the ActiveX control to not to work properly.

It works fine when showing a single image file, but I haven't figured out
how to properly show an image based on a list of multiple image files.

Mayayana

unread,
Jan 15, 2022, 5:38:47 PM1/15/22
to
"R.Wieser" <add...@not.available> wrote
I'm not familiar with that. I'm guessing it's just the image
handling code for an EXE, but I've never used the Windows
Picture Viewer. I don't see any reason to think the DLL is
going to give you a window.

Another option would be webvw.dll on XP, but it also
needs a display medium, like a webpage. Then there's WIA.
Again, you can do all sorts of things to images with it, but
you'll need something like a webpage to display the file.


Mayayana

unread,
Jan 15, 2022, 5:48:32 PM1/15/22
to
Decided to look into it. Not very useful, but here you go:

rundll32.exe C:\Windows\System32\shimgvw.dll,ImageView_Fullscreen
C:\windows\desktop\railings.gif

That should display the image in the path parameter.
I haven't tried it with script to see if there's a way to
get at it.


R.Wieser

unread,
Jan 16, 2022, 4:03:16 AM1/16/22
to
Mayayana,

> I'm guessing it's just the image handling code for an EXE, but
> I've never used the Windows Picture Viewer.

Not quite. Its one of those Windows frankenstein mosters. The registry
shows it for a JPG images "open" verb as follows :

rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1

Yeah, its a DLL that gets loaded after which its "ImageView_Fullscreen"
entry gets called (with the image filename as its argument)

... and I just see (from your next message) you already found that yourself.

But showing an image is not the problem. As stated in my initial message,
I want to be able to control the effect of the "next" and "previous"
buttons - showing a limited set outof all present in a folder, or show them
in a pre-programmed order.

> I don't see any reason to think the DLL is going to give you a window.

:-) See the above invocation. The DLL itself is quite capable of doing
so.

> Another option would be [snip]

I'm sorry, but I'm currently not looking for those. Dropping something
because I cannot instantly get it to work (when it looks like it
could/should) is not my thing. Also known as the "stubborn" trait. :-)

Regards,
Rudy Wieser



Mayayana

unread,
Jan 16, 2022, 8:55:27 AM1/16/22
to
"R.Wieser" <add...@not.available> wrote

| But showing an image is not the problem. As stated in my initial
message,
| I want to be able to control the effect of the "next" and "previous"
| buttons - showing a limited set outof all present in a folder, or show
them
| in a pre-programmed order.
|

For that I asume you'd need to do your own
folder making behind the scenes. If you look at the
typelib, no such functions seem to be available.

| > Another option would be [snip]
|
| I'm sorry, but I'm currently not looking for those. Dropping something
| because I cannot instantly get it to work (when it looks like it
| could/should) is not my thing. Also known as the "stubborn" trait. :-)
|

Stubborn is when you won't buy a new screwdriver,
even though yours has a worn tip. Your approach is more
like deciding that using a hacksaw as a screwdriver depends
only on one's dedication. And after all, no one ever got
famous for just using a screwdriver properly, so let's make
it more challenging...

That implies that actually turning the screw was never
relevant in the first place. It's just an afterthought to a
useless puzzle. I find it interesting to discover new functionality
in Windows COM objects. But only if it's *useful* functionality.

Anyway, I don't have time to look into this because I'm
working on a project to make a 600-piece jigsaw puzzle
of a waterfall out of a single slice of bread. Mr. Guinness,
here I come. :)


R.Wieser

unread,
Jan 16, 2022, 9:50:16 AM1/16/22
to
Mayayana,

> For that I asume you'd need to do your own folder making behind the
> scenes.

Ofcourse.

> If you look at the typelib, no such functions seem to be available.

:-) Why would the image viewer need to do any such thing ? It only needs
to ask me, when I press either the "next" or "previous" button, which image
it needs to display next. And whatdoyouknow, those two buttons have
callback capabilities.

Nope, I currently have no idea if those callbacks will actually allow me to
change the next image to be displayed, but as I can't really imagine another
usage for them its rather likely they will do just that.

Which is what my current trying and searching is all about.

> Your approach is more like deciding that using a hacksaw as a
> screwdriver depends only on one's dedication.

Damn... There I was, thinking it would be comparable to trying to find the
usermanual of a PVR to see if it can do something beyond the standard "play"
and "record". :-|

> Anyway, I don't have time to look into this

It was not my intention to put someone to work for me to figure everything
out, I just wanted to see if someone knew a bit more about it (read: has
information or knows where to find it) than what I can('t) find about it
using Google.

Regards,
Rudy Wieser


JJ

unread,
Jan 16, 2022, 10:45:25 PM1/16/22
to
On Sun, 16 Jan 2022 10:02:06 +0100, R.Wieser wrote:
>
> But showing an image is not the problem. As stated in my initial message,
> I want to be able to control the effect of the "next" and "previous"
> buttons - showing a limited set outof all present in a folder, or show them
> in a pre-programmed order.

Considering that the `ShowFile` method accepts a list of files, my best
guess is the `Show` method which accepts a variant whose value and usage is
unknown (not even a hint). It could be an exact file name/path from the
list, or an index (of unknown value type) of the list.

R.Wieser

unread,
Jan 17, 2022, 5:02:36 AM1/17/22
to
JJ,

> Considering that the `ShowFile` method accepts a list of files,

It does ? I've not been able to even turn up that kind of information. It
might explain why I do not see anything (and why cximage and cximage return
1).

Could you tell me where you found that information ?

> my best guess is the `Show` method which accepts a variant whose
> value and usage is unknown (not even a hint)

In my case trying to call it (with a zero) throws an "invalid procedure or
argument" error.

> It could be an exact file name/path from the list, or an index
> (of unknown value type) of the list.

Anything is possible, and currently I have got next-to-nothing to go on. :-\


But, I made a fool of myself :

I *assumed* that the callback events would be related to the user using the
different buttons. When looking at the DPreviewEvents object it turns out
the "forward" and "back" buttons don't generate any. :-(

I was so focussed on first getting a grip on the object itself that I
totally forgot to look at which events where available. :-\


But although that kills my "script those buttons" idea I still would like
whatever information, if any, you have on the object.

Regards,
Rudy Wieser


JJ

unread,
Jan 18, 2022, 1:55:20 AM1/18/22
to
On Mon, 17 Jan 2022 10:58:47 +0100, R.Wieser wrote:
> JJ,
>
>> Considering that the `ShowFile` method accepts a list of files,
>
> It does ? I've not been able to even turn up that kind of information. It
> might explain why I do not see anything (and why cximage and cximage return
> 1).
>
> Could you tell me where you found that information ?

It's from its Type Library. I thought you said you already have it. i.e.

[id(7), helpstring("method ShowFile")] void ShowFile(
BSTR bstrFileName,
int iSelectCount
);

I don't even have to touch its `cxImage` or `cyImage` to show one image.

>> my best guess is the `Show` method which accepts a variant whose
>> value and usage is unknown (not even a hint)
>
> In my case trying to call it (with a zero) throws an "invalid procedure or
> argument" error.

Could be because the image list is still empty.

> But although that kills my "script those buttons" idea I still would like
> whatever information, if any, you have on the object.

This is the Type Library IDL I've extracted from the DLL.

https://pastebin.com/ax0QCeDp

FYI, it was extracted using Total Commander's (TC) FileInfo lister plugin,
but the plugin can be used by open source TC clones which supports TC plugin
architecture such as Double Commander.

I used to use old Visual Studio's `OLE-COM Object Viewer` tool, but it's too
tedious to use.

R.Wieser

unread,
Jan 18, 2022, 2:20:52 AM1/18/22
to
JJ,

>> Could you tell me where you found that information ?
>
> It's from its Type Library. I thought you said you already have it. i.e.
>
> [id(7), helpstring("method ShowFile")] void ShowFile(
> BSTR bstrFileName,
> int iSelectCount
> );

What I did was to read the type library from shimgvw.dll itself and convert
it into human readable form. The downside of that is that I don't see any
variable names, just their types.

>> In my case trying to call it (with a zero) throws an "invalid procedure
>> or argument" error.
>
> Could be because the image list is still empty.

Throwing an error specific for a called procedure or its arguments instead
of one of the many other available ones ? Possible, but IMHO not likely.

> This is the Type Library IDL I've extracted from the DLL.
>
> https://pastebin.com/ax0QCeDp

Thank you. And if you extracted it /with/ those variable names I have to
take another look at my own extractor.

Regards,
Rudy Wieser


Mayayana

unread,
Jan 18, 2022, 8:48:43 AM1/18/22
to
"R.Wieser" <add...@not.available> wrote

| > [id(7), helpstring("method ShowFile")] void ShowFile(
| > BSTR bstrFileName,
| > int iSelectCount
| > );
|
| What I did was to read the type library from shimgvw.dll itself and
convert
| it into human readable form. The downside of that is that I don't see any
| variable names, just their types.
|

It's possible that variable designates a slideshow list. Then again,
maybe not. That's the trouble with "self-discoverable COM. It's
really not. You need docs. (Zoom also takes a parameter
iSelectCount.)

Also note, Show takes a variant but ShowFile takes
a string and long. It should work to send the values as
CStr(x), CLng(y) but it won't work if it's expecting a
null-delineated string.

Have you tried Irfan View? :)

With typelibs, I like the VB object viewer or my own
parser. But there's also the OLE-COB object viewer if
you have VS and like a verbose presentation. But that
basically just reconstitutes the typelib as an IDL file,
which is not very easily readable. I've only used it a
handful of times, to double-check an entry.


R.Wieser

unread,
Jan 18, 2022, 11:44:41 AM1/18/22
to
Mayayana,

> It's possible that variable designates a slideshow list.

True. On the other hand, it /should/ throw an error on something it doesn't
recognise/can't use.

And by the way, I just added the displaying of the variable names (which can
be retrieved using ITypeInfo::GetNames). It shows the arguments name as
"bstFileName". And that looks to be indicating a simple single filename.

> Then again,That's the trouble with "self-discoverable COM. It's really
> not. You need docs.

I think it depends on how well the variable names are choosen. And lets not
forget the help strings.

> (Zoom also takes a parameter iSelectCount.)

And in that case its choosen badly. :-|

> Also note, Show takes a variant but ShowFile takes
> a string and long.

I noticed.

> It should work to send the values as
> CStr(x), CLng(y) but it won't work if it's expecting a
> null-delineated string.

As I'm using VBScript to "talk" to it it should be doing all the
conversions. Thats what the typelib is for.

> Have you tried Irfan View? :)

Nope. I've heard of it for quite a number of years now, but for some
reason I never came around to looking at it.

> But that basically just reconstitutes the typelib as an IDL
> file, which is not very easily readable

:-) When I need a typelib I write those IDL files by hand.

Alas, my IDL compiler is Borlands mktypelib, and although when I bought
Tasm32 v5.0 I got some books with it they doesn't really start to explain
how to create such IDL files. Only recently I found out thru the Web that I
do not need to supply the "id(0x??)" parts to the method definitions.

Regards,
Rudy Wieser


JJ

unread,
Jan 19, 2022, 3:05:37 AM1/19/22
to
On Tue, 18 Jan 2022 08:19:44 +0100, R.Wieser wrote:
>
> Thank you. And if you extracted it /with/ those variable names I have to
> take another look at my own extractor.

It does. The output from the TC plugin is IIRC very similar to the output of
Microsoft's OLE-COM Object Viewer, in IDL format.

Some other tool such as PE Explorer, can convert and display Type Libraries
as text, but it's not in IDL format and some information are lost.

JJ

unread,
Jan 19, 2022, 3:37:54 AM1/19/22
to
On Tue, 18 Jan 2022 17:41:49 +0100, R.Wieser wrote:
>
> Alas, my IDL compiler is Borlands mktypelib, and although when I bought
> Tasm32 v5.0 I got some books with it they doesn't really start to explain
> how to create such IDL files. Only recently I found out thru the Web that I
> do not need to supply the "id(0x??)" parts to the method definitions.

MKTYPLIB is Microsoft's tool. Not Borland.

Borland doesn't have any TLB to IDL converter. IDL must either be created
manually by hand, or automated using C++ Builder or Delphi IDE's COM wizard.

Microsoft doesn't have any tool specifically for TLB to IDL conversion (i.e.
made just for that). Out of the box, its TLB to IDL converter is only
available and accessible from its OLE-COM Object Viewer tool where the
converter function is actually provided by TLBINF32.DLL. However, that DLL
is an Active X, so it can be used from any application which support Active
X.

R.Wieser

unread,
Jan 19, 2022, 6:20:12 AM1/19/22
to
JJ,

> MKTYPLIB is Microsoft's tool. Not Borland.

You're right. A quick "/?" shows its indeed MS-es product.

> Borland doesn't have any TLB to IDL converter.
...
> Microsoft doesn't have any tool specifically for TLB to IDL conversion

I wasn't looking such a tookl. Just one which would give me information
about the objects usage. And as none was freely available (I abhor having
to download-and-install multi-gigabyte environments just to be able to use a
simple tool outof it) I wrote one myself. :-)

Though at the moment of writing I seemingly did not put too much value on
the variable names as, as you have show yourself with that "iSelectCount"
argument name to the "Zoom" method, their usability fully depends on the
sanity of the developer coming up with them.

Regards,
Rudy Wieser


0 new messages