Author Topic: Program access to Windows 10 File Explorer PREVIEW PANE  (Read 3640 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Program access to Windows 10 File Explorer PREVIEW PANE
« on: November 11, 2020, 08:18:45 pm »
In Windows 10 File Explorer there is the option to display a preview of the file highlited on the right hand side of the window (PREVIEW PANE).

Is there a program way to say "Screen shot capture" this preview image? I was thinking of using a program to capture these "preview thumbnails" which although limited in resolution and extent - can give a quick idea of what the file is about without resorting to using the Windows File Explorer?

Because of the numerous file types that are displayable using the PREVIEW PANE, I expect it would be difficult to attempt to write a program to handle all file types in this manner by specifically "decoding" each of the file types.

Obviously I wanted to avoid "manually" achieving same by successive "Window snip" (or similar).

Can using Windows APIs achieve this?

Offline Kernelpanic

  • Newbie
  • Posts: 94
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #1 on: November 12, 2020, 07:19:00 pm »
Nice idea, but . . . excuse me, why? What should be the object of your idea? I do not understand it.
Mark Twain
"Als wir das Ziel endgültig aus den Augen verloren hatten, verdoppelten wir unsere Anstrengungen."
„Having lost sight of our goals, we redoubled our efforts.“

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #2 on: November 12, 2020, 08:54:18 pm »
@ Kernelpanic   -   thanks for reply. Just to try to clarify a bit better...


In the very old "DOS days" - I wrote a simple BASIC program that printed very basic file directory information to very small "cards" which were about twice the size of standard business cards. The information included:-

Volume name (of 3.5 inch disk), serial number, file path ...  AND a list of some 25 files in that path with information:-

Filename.ext date attributes clusters checksum etc AND the first 16 bytes of the file

The process was repeated for all files on all disks I had (no hard drive for me at the time). I ended up with hundreds of these "cards", which were of convenient physical size (actually fit inside sleeve of 3.5 inch disk), portable (ones being studied at the time fit in my shirt pocket) etc.

The most important aspect was "the first 16 bytes of each file" - a very crude "summary" of the file itself ("MZ" at the beginning indicated an .exe file for instance). So when file extensions were being changed at the time, and keeping in mind "virus attacks" at that time, I had a "primitive" means of "being aware" of "How When Where Why" (sort of) for each file. And using various colored "highlighter" pens and annotations - could group the cards into useful collections (all for use when away from a computer for long periods of time).


TODAY

Computer life is much more complicated and despite long file names being supported - more often than not - the filename.ext often gives "no clue" what a file is about. So a "simple summary" - and possibly the simplest approach is one format ( a "thumbnail" picture), whether it is some plain text, picture, etc. - would be a "modern" replacement for me from what I did in the past.

These "thumbnail pictures" would be portable (used independent from computer) - and although I may not hard copy print them out - would (on my grouping) still fit in my shirt pocket (eg for instance store pictures on a cheap mobile phone - so still 3.5" size and physically easy to work with. So, because of numerous problems with windows, for instance on many occasions Windows 10 put some downloads into a very heavily nested directory (many more than 6 levels down) and despite using Windows File Explorer Search (which for me seemed to ignore anything at more than 6 levels down for what I was searching for - the files (on occasions were effectively lost). The way around was to just use "DOS" and dump the entire C:\ drive to a text file and "wade through" all the 300,000 files + of windows, etc.

So now I try to automate (by using BASIC program) my methods - the large number of files warrant this - but still filenames (and extensions) may change ( for instance with a "virus attack" about a year ago, which as best I can tell came down (with "sheep's clothing" as a Video file) via YouTube (which was not actually launched by me). So I am back to "independently checking up on files" remote from a computer AND SO A SIMPLE SUMMARY AS A PICTURE IS HELPFUL FOR ME.

Windows 10 File Explorer PREVIEW PANE is probably good enough for me as you can see a "picture summary" for many file types. However, it requires access to a computer and also it is a pain to search through all possible directories (just look at the Windows folder itself for instance). I can write my own BASIC program to access just about any file, where ever it might be, but the "picture part for any file part" is the catch.

Hence why wanted to know how to program access Windows 10 PREVIEW PANE.

Hope the above clarifies my need a bit better.


Offline Kernelpanic

  • Newbie
  • Posts: 94
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #3 on: November 13, 2020, 11:54:28 am »
@Richard, I hope I translated everything correctly and understood it. My question yesterday wasn't so good, because the most important thing about a hobby is that it's fun. For me it's to distract me, so I fumble around with the GGC (Gnu Compiler), with the WLS (Windows Linux Subsystem), and now with Basic again.

I have reread your statement and now have at least an idea of ​​what you are aiming for. After what I know from earlier, the easiest way to achieve your ideas would be with the WSH (Windows Scripting Host). This gives you full access to all Windows functions, and the syntax is very similar to Basic. I have two "fat" books about it, in German. And if you want, you can also call the WSH program in QB64.

This is a very good book, maybe it is in English too. If so, it might also be available in a city library.
https://www.booklooker.de/app/detail.php?id=A01BYF6l01ZZr&pid=76312&t=cksa9sx73fs9cfea (3rd edition) and
https://www.amazon.de/Inside-Windows-Script-Host-G%C3%BCnter/dp/3860636162

This is an English edition:
http://www.borncity.com/web/WSHBazaar1/WSHBooks.htm

Here is a little program with it. It creates a folder on drive E: waits 5 seconds, then deletes it again without warning; it was about showing that you can actually bypass the usual Windows warning.

Code: [Select]
'Windows Scripting Host Beispiel, 15. April 2016
'Erstellen und Loeschen eines Ordners ohne Abfrage

Option Explicit

Dim Pfad, OrdnerAnzeigen
Dim fso, fo

'Create folder in
Pfad = "E:\TEMP\Beispiel"

'FileSystemObject erzeugen fuer Zugriff
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

'Create the folder
Set fo = fso.CreateFolder(Pfad)

'Show folder
OrdnerAnzeigen = fso.GetParentFolderName(Pfad)
Set fo = fso.GetFolder(OrdnerAnzeigen)

'Wait 5 sec.
WScript.Sleep 5000

'Delete folder without warning
fso.DeleteFolder(Pfad)
WScript.Quit
'***Ende
« Last Edit: November 13, 2020, 12:06:25 pm by Kernelpanic »
Mark Twain
"Als wir das Ziel endgültig aus den Augen verloren hatten, verdoppelten wir unsere Anstrengungen."
„Having lost sight of our goals, we redoubled our efforts.“

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #4 on: November 14, 2020, 07:25:53 pm »
@ Kernelpanic

Thank you for the information you supplied.

I checked up with all the Public Libraries in my region and no one has the publications on WSH (or related) - similarly no book stores have them.

I downloaded the zip files and did a quick read.

As I have never done any scripting before (have done cmd .BAT file processing) - I simply copied your WSH program (create/delete file on E:\) into QB64 IDE and ran it with no luck - of course many pre compilation errors (QB64 IDE) were generated.

You mentioned that the WSH program can be called in QB64 - could you give a simple QB64 code example on how to call your simple WSH from QB64? I am using Windows 10 x64 and I have not checked yet whether the needed WSH modules are actually present/activated.

Because of no luck getting hold on WSH publications - could you include some WSH information that relates to what Windows 10 File Explorer features can be programmed for?

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #5 on: November 15, 2020, 11:31:22 pm »
Ok you are talking about picture files not text files.

Why not use Microsoft picture manager?

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #6 on: November 15, 2020, 11:35:52 pm »
I tell you what, @Richard
I'd love to help you with this. I've been researching on my own for this issue (since I do WinAPI) and have not been able to find one that would work in QB64 (with the knowledge I possess). Here is a link that discusses this thing you are wanting and what it requires:

https://social.msdn.microsoft.com/Forums/en-US/80ea9a4c-f8d9-4d1b-ae6d-67558385c9e7/explorer-preview-pane-how-to?forum=vcgeneral
Shuwatch!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #7 on: November 16, 2020, 12:08:16 am »
@ SpriggsySpriggs

Thankyou for your reply.

I quickly looked at the link you provided - and was overwhelmed by the shear number of articles cross-referenced - I found two that MAY give some insight to the problem at hand.

  [ You are not allowed to view this attachment ]  

   [ You are not allowed to view this attachment ]  

I do not know enough about anything that would be involved and whether the above is "Windows API territory" and whether QB64 could use same.

Hope the above assists you with the task.
« Last Edit: November 16, 2020, 12:09:56 am by Richard »

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #8 on: November 16, 2020, 01:08:50 am »
@ NOVARSEG

Thanks for your reply.

I have just downloaded Microsoft Picture Manager (SharePointDesigner) and will soon try it out. Note that I do not have and never used Office etc and so will see if above is a truely "stand alone" application, and whether or not I can "program inject key-strokes". My original requirements were not limited only to pictures - I wanted the effect that Windows 10 PREVIEW PANE was able to display (sort of) a lets say over-sized thumbnail of the highlited file.

Offline Kernelpanic

  • Newbie
  • Posts: 94
    • View Profile
Re: Program access to Windows 10 File Explorer PREVIEW PANE
« Reply #9 on: November 16, 2020, 02:36:52 pm »
@Richard - Thats how it works - ENVIRON$ have to the full path to your folder with the VBS-file. But how one can pass arguments? That is another problem.
In QuickBasic 4.02 I tried this with a C file, and it worked, but it was compiled with QuickC 2.5. Whether the GCC works like that too . . .

Code: QB64: [Select]
  1. 'Call a Visual Basic Script Program with MsgBox - 16. Nov. 2020
  2.  
  3. SHELL "cscript //NoLogo " + ENVIRON$("D:\Lab\QuickBasic64\Extern") + "CreateFolder.VBS"
  4.  
  5.  
---
Code: QB64: [Select]
  1. Option Explicit
  2.  
  3. Dim Pfad, OrdnerAnzeigen
  4. Dim fso, fo
  5.  
  6. MsgBox "Create and delete a folder.."
  7.  
  8. 'Ordner Beispiel erstellen
  9. Pfad = "E:\TEMP\Beispiel"
  10.  
  11. 'FileSystemObject erzeugen für Zugriff
  12. Set fso = WScript.CreateObject("Scripting.FileSystemObject")
  13.  
  14. 'Ordner erstellen
  15. Set fo = fso.CreateFolder(Pfad)
  16.  
  17. 'Neu erstellten Ordner anzeigen
  18. OrdnerAnzeigen = fso.GetParentFolderName(Pfad)
  19. Set fo = fso.GetFolder(OrdnerAnzeigen)
  20.  
  21. '5 Sekunden warten
  22. WScript.Sleep 5000
  23.  
  24. 'Ordner ohne Nachfrage loeschen
  25. fso.DeleteFolder(Pfad)
  26. WScript.Quit
  27. '***Ende
  28.  

A script can you write in Notepad++ - for example. Then click on it. You can copied it also to the desktop.
https://notepad-plus-plus.org/

Mark Twain
"Als wir das Ziel endgültig aus den Augen verloren hatten, verdoppelten wir unsere Anstrengungen."
„Having lost sight of our goals, we redoubled our efforts.“