Discussion:
how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ?
(too old to reply)
R.Wieser
2022-01-14 09:39:29 UTC
Permalink
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
2022-01-14 12:01:31 UTC
Permalink
Post by R.Wieser
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
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
2022-01-14 19:24:17 UTC
Permalink
JJ,
Post by 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
2022-01-15 20:26:46 UTC
Permalink
Post by R.Wieser
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
2022-01-15 22:38:37 UTC
Permalink
"R.Wieser" <***@not.available> wrote

| 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 ...)
|

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.
R.Wieser
2022-01-16 09:02:06 UTC
Permalink
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
2022-01-16 13:55:17 UTC
Permalink
"R.Wieser" <***@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
2022-01-16 14:47:23 UTC
Permalink
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
2022-01-17 03:45:19 UTC
Permalink
Post by R.Wieser
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
2022-01-17 09:58:47 UTC
Permalink
JJ,
Post by 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 ?
Post by JJ
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.
Post by JJ
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
2022-01-18 06:55:15 UTC
Permalink
Post by R.Wieser
JJ,
Post by 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.
Post by R.Wieser
Post by JJ
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.
Post by R.Wieser
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
2022-01-18 07:19:44 UTC
Permalink
JJ,
Post by JJ
Post by R.Wieser
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.
Post by JJ
Post by R.Wieser
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.
Post by JJ
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
2022-01-18 13:48:31 UTC
Permalink
"R.Wieser" <***@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
2022-01-18 16:41:49 UTC
Permalink
Mayayana,
Post by 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.
Post by Mayayana
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.
Post by Mayayana
(Zoom also takes a parameter iSelectCount.)
And in that case its choosen badly. :-|
Post by Mayayana
Also note, Show takes a variant but ShowFile takes
a string and long.
I noticed.
Post by Mayayana
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.
Post by Mayayana
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.
Post by Mayayana
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
2022-01-19 08:37:51 UTC
Permalink
Post by R.Wieser
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
2022-01-19 11:19:34 UTC
Permalink
JJ,
Post by JJ
MKTYPLIB is Microsoft's tool. Not Borland.
You're right. A quick "/?" shows its indeed MS-es product.
Post by JJ
Borland doesn't have any TLB to IDL converter.
...
Post by JJ
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

JJ
2022-01-19 08:05:34 UTC
Permalink
Post by R.Wieser
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.
Mayayana
2022-01-15 22:48:21 UTC
Permalink
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.
Loading...