Another thing to consider is that Explorer will change in the (near) future.
Windows now supports tabbed file explorers
Currently launching explorer adds a new window vs. a new tab
But I hope that they’ll add a setting like Terminal has to open cmd prompts as a tab
see Terminal > Settings > StartUp > New Instance Behavior
choices are
Create a new window
Attach to the most recently used window
Attach to the most recently used window on this desktop
We are 23 posts into this Topic and have ZERO Code and ZERO Error messages, we just know something does not work. He mentions OddJob uses CreateProcess … but for what methods is he calling? This is a snipe hunt.
Quickly provide what users already know while at the same time bring them forward into a new and consistent folder/file structure for managing dept purchasing documents within their new purchasing application. The key word here is quickly.
If the process has been created using CreateProcess or ShellExecuteEx, your program knows the TID of the main thread of that process (some work is required for that in case of ShellExecuteEx). Hence, your program can use the PostThreadMessage API function to post WM_CLOSE (or WM_QUIT, or other messages) to the message queue of that thread. Just the File Explorer remains alive if such messages have been posted from outside…
The solution that we chose (about 15+ years ago, using C6) was a combination of SysTree and SysList on a window. I made a couple of improvements to SysList so that it cached the icons of the various file types instead of looking up that info every time.
We also needed Explorer menus, which we paid Jim Kane to write that part.
Overall, the solution worked well enough. It was nice to limit the folders to the ones our app cared about.
The Explorer-style Open/Save File dialog can do many things which are available with the File Explorer. Clarion FILEDIALOG could be used if to hide entry field where names of selected files are displayed and if to change text in buttons. There are ways to customize standard dialogs - see the article about “classic” approach to customization and another one about new customization interface. The customized file dialog can be executed in a program thread rather than a separate process in case of File Explorer.
@also mentions Clarion’s RUN uses the createprocess api.
Here is some code which shows some of the differences createprocess can do, like inherited access tokens aka bInheritHandles.
There is a lot of info on this thread to call a process or run a program.
I havent looked at calling Explorer so I dont know if its different but SysInternals ProcessExplorer should give you the necessary insight. You can see partial screenshots of ProcessExplorer in that link to the thread posted just above which shows the difference between the bInheritHandles.
As there is code there, you could trying using it to call Explorer and then see if Oddjob can kill it.
Dont know if its something OddJob should be able to do or not though.