[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
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

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

Post by *MVV »

I've set up opening Office documents with Explorer preview (assigned view mode 8 for *.doc and *.docx) and noticed some bugs.

1. When I open a DOCX by F3, there is no cursor initially, I can't scroll document with mouse or close Lister by Esc.
2. When I click anywhere in document, I can scroll with mouse or close Lister by Esc, but text shifts so it becomes cropped (e.g. a few first document lines go up beyond document borders), and resizing Lister window fixes it.

Behaviour may be reproduced with e.g. this sample document:
https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.docx
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

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

Post by *Horst.Epp »

No Explorer preview possible in my environment but the preview using ULister is ok.
It has a cursor from beginning and no other strange effects.
So you have some bad Explorer preview handler for docx.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
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'm sorry, I do not have Microsoft office so I can neither test it nor provide a fix. Try using ULister instead.
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 »

MVV wrote: 2020-02-28, 12:03 UTC1. When I open a DOCX by F3, there is no cursor initially, I can't scroll document with mouse or close Lister by Esc.
2. When I click anywhere in document, I can scroll with mouse or close Lister by Esc, but text shifts so it becomes cropped (e.g. a few first document lines go up beyond document borders), and resizing Lister window fixes it.
With Microsoft Office 2010 installed on Vista 32-bit, I cannot confirm above problems with sample document from first post or some other doc/docx I tried with Lister's Explorer preview my PC. There is a focus on document, mouse scrolling and Esc work, text lines don't disappear while/after scrolling.
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 »

Sorry, I don't use ULister and don't want to install it. I just report my observations regarding Explorer preview with standard Microsoft Office 2016 preview handler under Windows 7. And there are other people that confirm this behaviour. If there is something that I can do to help, feel free to ask. BTW MS Office may be downloaded for trying it out, as I know.
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 »

It would be nice though to have this fixed because currently new mode isn't too useful due to this behaviour. It is interesting of course if this behaviour is MS Office specific or may be observed with some other preview modules.
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) »

Sorry, even if I could reproduce it I wouldn't be able to fix it. All I do is load the Explorer preview and tell it where to open and with which size.
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 »

But there should be a reason why it loads with incorrect size in TC and works properly in Explorer. Maybe incorrect API usage or something else. Though it may also be a bug in Office plugin...

And, I think that mentioned focus problem may be fixed by putting focus into preview frame...

BTW I tried Alt+F4 after opening viewer by F3 on a .docx file to close viewer, and preview frame was closed leaving empty Lister window.

As I see, there is a window chain: TLister - _WwB - _WwG. Or in case of Explorer window: Shell Preview Extension Host Previewer - _WwB - _WwG. So perhapse focus problem happens because wrong window is focused, but it is strange anyway why TCKEYHANDLER.DLL is unable to handle Esc press in that window...

Lastly noticed: TCx64 handles Esc in Office previewer properly, only TCx86 is unable to handle Esc. I've checked, in both cases child window belongs to 32-bit winword.exe process.
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) »

The API is very simple.

TCKEYHANDLER.DLL sets a local (app thread) hook if the viewer window belongs to the same thread as Lister. Otherwise it sets a global hook.

To find the Lister or Total Commander top level window hosting the view, I call GetForegroundWindow() when I receive the ESC keypress, and then GetParent until there is no more parent (Lister is a top level window).
To be sure that I'm in a viewer window, I call GetFocus, and then GetParent until the window has a property atom set (via GetProp). This property is set to the Lister window only.

It's possible that the .docx preview isn't set as a child of lister (or a child of the child), then my detection will fail. Maybe you have a better idea how to handle this.
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 »

Do you install both 32/64 bit hooks? Since preview windows may be hosted in different processes, you need a hook DLL that may be loaded into these processes. Perhaps another one may be installed via TCMDX32.EXE/TCMDX64.EXE.

But here in my case TCx86 fails to handle Esc when viewing a document using 32-bit winword.exe with loaded TCKEYHANDLER.DLL into it.


I could try testing with some debug version that logs window handles and process names/ids if you would make such one.
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 don't think you can load a 32-bit dll from 64-bit programs and vice versa, even for hooks.
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 »

That's correct, so you can load one into TC directly and another one into TCMDX32.EXE/TCMDX64.EXE in order to install both hook modules.
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) »

Sorry, that would be overkill. Is there a way to find out whether an extension is 32-bit or 64-bit?
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 »

I don't know. Perhaps you can find its window inside Lister window and get its process id. But if this window is from process with different architecture, you won't be able to install hook for it just from TC.
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'm aware of that, but at least I wouldn't have to install hooks for both.

But I cannot find any function to determine whether a window handle is from a 32-bit or 64-bit process...
Author of Total Commander
https://www.ghisler.com
Post Reply