Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12379 > unrolled thread

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

Started by"R.Wieser" <address@not.available>
First post2022-01-14 10:39 +0100
Last post2022-01-15 17:48 -0500
Articles 18 — 3 participants

Back to article view | Back to microsoft.public.scripting.vbscript


Contents

  how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-14 10:39 +0100
    Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-14 19:01 +0700
      Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-14 20:24 +0100
        Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-16 03:26 +0700
    Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "Mayayana" <mayayana@invalid.nospam> - 2022-01-15 17:38 -0500
      Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-16 10:02 +0100
        Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "Mayayana" <mayayana@invalid.nospam> - 2022-01-16 08:55 -0500
          Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-16 15:47 +0100
        Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-17 10:45 +0700
          Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-17 10:58 +0100
            Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-18 13:55 +0700
              Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-18 08:19 +0100
                Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "Mayayana" <mayayana@invalid.nospam> - 2022-01-18 08:48 -0500
                  Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-18 17:41 +0100
                    Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-19 15:37 +0700
                      Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "R.Wieser" <address@not.available> - 2022-01-19 12:19 +0100
                Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? JJ <jj4public@gmail.com> - 2022-01-19 15:05 +0700
    Re: how to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ? "Mayayana" <mayayana@invalid.nospam> - 2022-01-15 17:48 -0500

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

From"R.Wieser" <address@not.available>
Date2022-01-14 10:39 +0100
Subjecthow to automate preview.preview ("windows picture and fax viewer" -> shimgvw) ?
Message-ID<srrgcv$5m1$1@gioia.aioe.org>
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

[toc] | [next] | [standalone]


#12380

FromJJ <jj4public@gmail.com>
Date2022-01-14 19:01 +0700
Message-ID<1fe89vhwtcprd$.1wcpafpbf9jzy.dlg@40tude.net>
In reply to#12379
On Fri, 14 Jan 2022 10:39:29 +0100, R.Wieser wrote:
> 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.

[toc] | [prev] | [next] | [standalone]


#12381

From"R.Wieser" <address@not.available>
Date2022-01-14 20:24 +0100
Message-ID<srsile$109$1@gioia.aioe.org>
In reply to#12380
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.

[toc] | [prev] | [next] | [standalone]


#12382

FromJJ <jj4public@gmail.com>
Date2022-01-16 03:26 +0700
Message-ID<jgfe49qqotpl.dtyxgbbwhl6o.dlg@40tude.net>
In reply to#12381
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.

[toc] | [prev] | [next] | [standalone]


#12383

From"Mayayana" <mayayana@invalid.nospam>
Date2022-01-15 17:38 -0500
Message-ID<srvidk$9nr$1@dont-email.me>
In reply to#12379
"R.Wieser" <address@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. 

[toc] | [prev] | [next] | [standalone]


#12385

From"R.Wieser" <address@not.available>
Date2022-01-16 10:02 +0100
Message-ID<ss0n0e$1r3n$2@gioia.aioe.org>
In reply to#12383
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


[toc] | [prev] | [next] | [standalone]


#12386

From"Mayayana" <mayayana@invalid.nospam>
Date2022-01-16 08:55 -0500
Message-ID<ss184c$is$1@dont-email.me>
In reply to#12385
"R.Wieser" <address@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. :)

[toc] | [prev] | [next] | [standalone]


#12387

From"R.Wieser" <address@not.available>
Date2022-01-16 15:47 +0100
Message-ID<ss1bb6$ask$2@gioia.aioe.org>
In reply to#12386
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

[toc] | [prev] | [next] | [standalone]


#12388

FromJJ <jj4public@gmail.com>
Date2022-01-17 10:45 +0700
Message-ID<j76mos8ge1bs$.1a6gdarmzxnbk$.dlg@40tude.net>
In reply to#12385
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.

[toc] | [prev] | [next] | [standalone]


#12389

From"R.Wieser" <address@not.available>
Date2022-01-17 10:58 +0100
Message-ID<ss3erp$k2i$1@gioia.aioe.org>
In reply to#12388
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

[toc] | [prev] | [next] | [standalone]


#12390

FromJJ <jj4public@gmail.com>
Date2022-01-18 13:55 +0700
Message-ID<1qcojm4ok54ji$.1a0wadzporkoo.dlg@40tude.net>
In reply to#12389
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.

[toc] | [prev] | [next] | [standalone]


#12391

From"R.Wieser" <address@not.available>
Date2022-01-18 08:19 +0100
Message-ID<ss5pog$1c86$1@gioia.aioe.org>
In reply to#12390
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

[toc] | [prev] | [next] | [standalone]


#12392

From"Mayayana" <mayayana@invalid.nospam>
Date2022-01-18 08:48 -0500
Message-ID<ss6gfn$9gs$1@dont-email.me>
In reply to#12391
"R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#12393

From"R.Wieser" <address@not.available>
Date2022-01-18 17:41 +0100
Message-ID<ss6qpk$1ii9$1@gioia.aioe.org>
In reply to#12392
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

[toc] | [prev] | [next] | [standalone]


#12395

FromJJ <jj4public@gmail.com>
Date2022-01-19 15:37 +0700
Message-ID<pos23ublqbqc$.vk4boohb8pc6$.dlg@40tude.net>
In reply to#12393
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.

[toc] | [prev] | [next] | [standalone]


#12396

From"R.Wieser" <address@not.available>
Date2022-01-19 12:19 +0100
Message-ID<ss8s5a$17lp$2@gioia.aioe.org>
In reply to#12395
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

[toc] | [prev] | [next] | [standalone]


#12394

FromJJ <jj4public@gmail.com>
Date2022-01-19 15:05 +0700
Message-ID<4i2670mfylne.8pfs8kqjbjp6.dlg@40tude.net>
In reply to#12391
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.

[toc] | [prev] | [next] | [standalone]


#12384

From"Mayayana" <mayayana@invalid.nospam>
Date2022-01-15 17:48 -0500
Message-ID<srvivs$d31$1@dont-email.me>
In reply to#12379
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. 

[toc] | [prev] | [standalone]


Back to top | Article view | microsoft.public.scripting.vbscript


csiph-web