[9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *DrShark »

2MVV
For the sample file I confirm all the problems you described also on Windows 7 32-bit with Word 2016, and there 32-bit Lister uses with 32-bit Word preview handler...
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *MVV »

ghisler(Author),
Well, you can e.g. find window, then GetWindowThreadProcessId, OpenProcess and check IsWow64Process...
But since user may open multiple Lister windows, you may still need to install both hooks at once, so I don't think that it is a problem.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *petermad »

MVV wrote: 2020-02-28, 12:03 UTC Behaviour may be reproduced with e.g. this sample document:
https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.docx
I don't have Microsoft Word, but I have Microsoft Word Viewer. I cannot open this file in Microsoft Word Viewer - maybe it is not fully kosher?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *MVV »

petermad wrote: 2020-03-12, 22:26 UTCI don't have Microsoft Word, but I have Microsoft Word Viewer. I cannot open this file in Microsoft Word Viewer - maybe it is not fully kosher?
I don't know what Microsoft Word Viewer is, but Wikipedia says that it is a very old software that was only compatible with Word 2007. So I doubt that it supports Office Open XML (*X) formats.
And, most of DOCX documents on my machine have mentioned problem with zoom, and all of them have mentioned problem with Esc key.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *petermad »

I don't know what Microsoft Word Viewer
It is a free viewer for Word documents made by Microsoft - but I see now that Micro$oft has discontinued it and also dropped updates for it: https://support.office.com/en-us/article/microsoft-office-word-viewer-b1772025-1ce0-4a66-ade9-154303e2a3ca

There were also a free Excel viewer and PowerPoint viewer from Microsoft
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *ghisler(Author) »

I found something interesting: Apaprently there is a bug in the Word preview handler.
See this page at the very end:
https://geelaw.blog/entries/ipreviewhandlerframe-wpf-2-interop/

SetWindow should set both the parent and the size, but apparently the Word viewer ignores the size passed via SetWindow.
So calling SetRect immediately after SetWindow should fix the problem - I will try that.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *ghisler(Author) »

Unfortunately it doesn't seem to work every time, although it's a bit better now...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *MVV »

Well, that's better than nothing. :)
Have you dealt with Esc key in Explorer preview mode?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *ghisler(Author) »

Yes, Esc seems to work - I also added 1..8 and n/p handling - except when opening multiple Word files at once, e.g. one as Ctrl+Q and one as a Lister window. This works with other formats like HTM or PDF, so it's probably another bug in the Word viewer...
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *DrShark »

history951.txt wrote:16.03.20 Fixed: Lister, Explorer preview: Call SetRect immediately after SetWindow to handle bug in Microsoft Word preview handler sized incorrectly (32/64)
Actyally two methods are added:
1) SetRect immediately after SetWindow
and
2) for *.docx extension only, experimental: Call SetWindow with 1 pixel less height than window size, then SetRect with correct height

Both methods seems to work fine (tested 1st one with *.doc, second one with *.docx) on 32-bit Windows - there are no hidden lines, but only if Explorer Preview is set as default view mode for *.doc, *.docx (after setting Explorer Preview as default for some extensions, it's better to restart TC to make sure they're used).
Even if ExplorerPreview is default, it doesn't seem to be working in QuickView: there it's random whether the document will get correct look (at least for sample document from start post), so the question is whether SetRect is called for QuickView...
Also there is a Word 2010-speific issue on Vista 32-bit: there if many Lister copies with Word preview opened, on switch between Lister instances after activating a window of each, first document lines of documen in Word preview will become hidden.

If ExplorerPreview method is not default for *.doc/*.docx, and switch goes vie 8 key, on Windows 7 32-bit with Word 2016 few first document lines are usually hidden but randomly the document may be opened with correct look. In this case, there is also mentioned above problem with not working keys in Lister window if QuickView with Word preview is already opened - it's because after pressing 8 in Lister TC window takes the focus.

2ghisler(Author)
Is it possible to add SetRect call also for following events:
1) switch to Explorer preview mode manually e.g. by pressing 8 key;
2) activation of inactive Lister window;
?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *MVV »

Well, Escape key is now works just after F3 - great!

However there are still issues that I see with TC x86/x64 and Office 2016 x86 under Windows 7 x64 (I have assigned explorer preview for .doc and .docx files).

1. I use F3 for viewing a document (including mentioned sample) in Lister:
1.1. What I have just after opening Lister window:
1.1.a. Document window gets proper size and position: e.g. TLister window size 1173x772, _WwB window size is 1165x726 and position (0, 0) in TLister, _WwG window size is 1149x726 and position (0,0) in _WwB.
1.1.b. Document zoom and scroll position are correct.
1.1.c. Escape works.
1.1.d. Resizing Lister window works correctly.
1.1.e. Mouse wheel doesn't scroll the document. It seems that proper window doesn't get focus. But perhaps it is a preview handler specific issue 'cause there is no need in immediate focus in Explorer window.
1.1.f. If I run a tool like KatMouse (that allows scrolling inactive windows under mouse pointer), mouse wheel is able to scroll the document.
1.2. If I click anywhere inside Lister client rectangle:
1.2.a. Now mouse wheel is able to scroll document.
1.2.b. Document window gets moved and resized in a buggy way so its top part and right border of scrollbar are cropped: e.g. now _WwB window size 1173x772 and position (-4,-42) in TLister, and _WwG window size is 1157x772 and position (0,0) in _WwB.
1.2.c. If I resize Lister window, document gets positioned properly again.

I don't understand what happens when I click document window in 1.2.b and why it only happens only for the first click on that window, looks like some kind of a postponed initialization that results in moving document window into strange position. I guess though that _WwB here simply gets occupied entire Lister window because its absolute size and position is the same after moving. I've checked how it looks in Explorer window and noticed that there are more intermediate windows: CtrlNotifySink - Shell Preview Extension Host - Shell Preview Extension Host Previewer - _WwB _WwG. I think adding one intermediate child window should solve the wrong positioning problem.

2. I use Ctrl+Q for viewing a document in quick view panel:
2.1. What I have just after opening quick view panel:
2.1.a. Document window gets proper size and position: e.g. TLister window size 505x502, _WwB window size is 501x498 and position (0, 0) in TLister, _WwG window size is 485x482 and position (0,0) in _WwB.
2.1.a. Most of time document gets shown with weird zoom or scroll position so I only see white sheet and a scrollbar, but sometimes it gets shown properly.
2.1.b. If I resize TC window or move panel separator, document gets positioned properly.
2.1.c. If I run a tool like KatMouse (that allows scrolling inactive windows under mouse pointer), mouse wheel is able to scroll the document, and scrolled document gets proper zoom and position.
2.2. If I click anywhere inside quick view panel:
2.2.a. Now mouse wheel is able to scroll the document.
2.2.b. Document window gets moved and resized a bit in a buggy way so its top part and right border of scrollbar are cropped: e.g. now _WwB window size is 505x502 and position (-2,-2) in TLister, _WwG window size is 489x486 and position (0,0) in _WwB.

It seems that in 2.2.b again _WwB takes its entire parent window size and position, not just its client part. So I suppose adding an intermediate child should help here too.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *ghisler(Author) »

Do you see any difference between RC5a and RC6 regarding document resizing?
Is it possible to add SetRect call also for following events:
1) switch to Explorer preview mode manually e.g. by pressing 8 key;
I'm already doing this...
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *DrShark »

ghisler(Author) wrote: 2020-03-19, 09:36 UTCDo you see any difference between RC5a and RC6 regarding document resizing?
After today tests I don't see some significant differences for both *.doc and *.docx, in both builds:
* F3 with Explorer Preview set as default for *.doc, *.docx - correct look.
* pressing 8 after F3 in above case or after opening Lister with Alt+Shift+F3 - first docment lines usually (but not always) become hidden.
* for QuickView it's random whether look will be correct no matter whether Explorer Preview set as default for *.doc, *.docx or not.
ghisler(Author) wrote: 2020-03-19, 09:36 UTC
Is it possible to add SetRect call also for following events:
1) switch to Explorer preview mode manually e.g. by pressing 8 key;
I'm already doing this...
Just to make it clear: when pressing 8, for *.docx, is it simple SetRect or "SetWindow with 1 pixel less height than window size, then SetRect with correct height"?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [9.51rc3 x86] Lister Explorer preview opens DOC/DOCX cropped

Post by *ghisler(Author) »

I was able to install Office 2016 demo now in a virtual machine. I found some solutions for the bad behaviour of the docx viewer, but not for all:
1. It only seems to work correctly when the parent window is not visible yet when creating the docx viewer. So creating a hidden child window in lister before loading the docx plugin seems to help.
2. The plugin doesn't allow scrolling with the keyboard after calling setFocus(). It works only after clicking with the mouse in it, sometimes only after selecting some text. Do you have this problem too? I couldn't find a solution for this so far.
Author of Total Commander
https://www.ghisler.com
Post Reply