Discussion:
TmpCreat: selecting a file upon exit?
(too old to reply)
Harry Potter
2018-02-17 08:26:02 UTC
Permalink
I did some homework this morning and couldn't find the necessary information. The problem is that I need my Template Creator program to highlight a created file upon program exit on *all* Win32/64 systems. How do I do this?

BTW, the program is written in C using the WinAPI and the Open Watcom C compiler.
JJ
2018-02-17 14:03:16 UTC
Permalink
Post by Harry Potter
I did some homework this morning and couldn't find the necessary
information. The problem is that I need my Template Creator program to
highlight a created file upon program exit on *all* Win32/64 systems.
How do I do this?
BTW, the program is written in C using the WinAPI and the Open Watcom C compiler.
What's the use of highlighting a file if your program is terminating?
Harry Potter
2018-02-17 14:25:06 UTC
Permalink
Post by JJ
What's the use of highlighting a file if your program is terminating?
It's actually a Wizard that creates a new file based on a template file. The user chooses a template; then the program creates the file, highlights the file name and exits. Does this help?
JJ
2018-02-18 02:36:54 UTC
Permalink
Post by Harry Potter
It's actually a Wizard that creates a new file based on a template file.
The user chooses a template; then the program creates the file,
highlights the file name and exits. Does this help?
You can use the WebViewFolderContents shell scripting object.
Harry Potter
2018-02-18 13:47:37 UTC
Permalink
Post by JJ
You can use the WebViewFolderContents shell scripting object.
It seems to *display* a folder. I need to *highlight* a file that's being created.
JJ
2018-02-18 18:14:11 UTC
Permalink
Post by Harry Potter
Post by JJ
You can use the WebViewFolderContents shell scripting object.
It seems to *display* a folder. I need to *highlight* a file that's being created.
Oh, really? Read the document again. I'm sure you missed the information
you're looking for.
Kaz Kylheku
2018-02-18 22:44:54 UTC
Permalink
Post by JJ
Post by Harry Potter
Post by JJ
You can use the WebViewFolderContents shell scripting object.
It seems to *display* a folder. I need to *highlight* a file that's being created.
Oh, really? Read the document again. I'm sure you missed the information
you're looking for.
By the way, while glancing around MSDN in relation to this topic,
spotted this:

"SHCreateShellFolderView is recommended over SHCreateShellFolderViewEx
because of the greater flexibility of its elements to participate in
various scenarios, provide new functionality to the view, and interact
with other objects."

You heard it: Non-Ex recommended over Ex due to greater flexibility and
functionality!
--
TXR Programming Lanuage: http://nongnu.org/txr
Music DIY Mailing List: http://www.kylheku.com/diy
ADA MP-1 Mailing List: http://www.kylheku.com/mp1
JJ
2018-02-19 05:30:49 UTC
Permalink
Post by Kaz Kylheku
By the way, while glancing around MSDN in relation to this topic,
"SHCreateShellFolderView is recommended over SHCreateShellFolderViewEx
because of the greater flexibility of its elements to participate in
various scenarios, provide new functionality to the view, and interact
with other objects."
You heard it: Non-Ex recommended over Ex due to greater flexibility and
functionality!
Notice those 3 fields in the CSFV structure? Microsoft always drives
developers away from undocumented features. In this case, a function which
exposes the possibility of undocumented features.

Kaz Kylheku
2018-02-17 16:17:10 UTC
Permalink
Post by JJ
Post by Harry Potter
I did some homework this morning and couldn't find the necessary
information. The problem is that I need my Template Creator program to
highlight a created file upon program exit on *all* Win32/64 systems.
How do I do this?
BTW, the program is written in C using the WinAPI and the Open Watcom C compiler.
What's the use of highlighting a file if your program is terminating?
E.g. an installer program could pop up a folder with the release notes
readme file just before terminating.

In general any program which produces the file could call the Shell API
to tell Windows Explorer to pop up a folder, with that file selected.

A web browser like Firefox somehow does this. You know how you can go
to Downloads and "Open Containing Folder" for a given file?

(Now if the browser quit just after doing that, you'd have the gist of
this feature.)
--
TXR Programming Lanuage: http://nongnu.org/txr
Music DIY Mailing List: http://www.kylheku.com/diy
ADA MP-1 Mailing List: http://www.kylheku.com/mp1
R.Wieser
2018-02-18 15:07:17 UTC
Permalink
Harry,
Post by Harry Potter
I need my Template Creator program to highlight a created file upon
program exit
When your program exits:

#1: there are no other programs open, and the file is not created on the
desktop. What should happen ?

#2: there are multiple programs open showing the folder in which the new
file is created. What should happen ?
Post by Harry Potter
... on *all* Win32/64 systems.
Open Explorer with the just-created filename as an argument. Will probably
work (read: untested).

Regards,
Rudy Wieser
Harry Potter
2018-02-18 16:40:00 UTC
Permalink
Post by R.Wieser
#1: there are no other programs open, and the file is not created on the
desktop. What should happen ?
Well...the program is a ShellNew extension, so the folder containing the file should be open upon program exit, but, if not, maybe nothing. :)
Post by R.Wieser
#2: there are multiple programs open showing the folder in which the new
file is created. What should happen ?
The one in which the file is created. The one in which the user used the ShellNew ption.
Post by R.Wieser
Post by Harry Potter
... on *all* Win32/64 systems.
Open Explorer with the just-created filename as an argument. Will probably
work (read: untested).
I don't think that will work.
R.Wieser
2018-02-18 19:15:34 UTC
Permalink
Harry,
Post by Harry Potter
Post by R.Wieser
#1: there are no other programs open, and the file is not created on the
desktop. What should happen ?
Well...the program is a ShellNew extension, so the folder containing the
file
should be open upon program exit, but, if not, maybe nothing. :)
Problem: You *knew* how your program is started, but did not include that
info in your question. What do you think we are, mindreaders or something ?
Post by Harry Potter
Post by R.Wieser
#2: there are multiple programs open showing the folder in which the new
file is created. What should happen ?
The one in which the file is created.
There are 10 programs open, *all* showing the folder in which the file is
created. Which of those is it going to be ? In other words, *think*
before penning down a reply.
Post by Harry Potter
The one in which the user used the ShellNew ption.
Question: If-and-when you're using the ShellNew option, the newly created
file is *allways* the one at the bottom, and *always* in plain sight. Why
do you need to hilite it too ?

Even better: Why do you (feel the) need to make your program do something
which none of the other ShellNew options does ?

And if you *must* do something like that, why don't you just open the
just-created file (which will automatically happen with the associated
program) ?
Post by Harry Potter
Post by R.Wieser
Open Explorer with the just-created filename as an argument. Will
probably work (read: untested).
I don't think that will work.
Wrong answer. The *correct* answer is "Thank you, I will check that
out" -- and *mean* it.

Take a guess what I did before posting that suggestion. And another guess
why I didn't just copy-paste the google result ...

Regards,
Rudy Wieser
Loading...