ElektroStudios / Easy-Link-File-Viewer

Desktop application for Windows to read, modify and write shortcut files (.lnk) with ease.
Apache License 2.0
120 stars 11 forks source link

[BUG] opening a file does not read the "Window State" attribute, is always "Normal" #14

Closed R-Chandra closed 1 week ago

R-Chandra commented 2 weeks ago

Describe the bug Shortcuts/.lnk files which have another window state, such as maximized or minimized, are always read as "Normal"

To Reproduce Steps to reproduce the behavior: Open any .lnk file by any means (explorer.exe send to, invoke application and File/Open (or click Open button), Open in Easy Link File Viewer, etc.)

Expected behavior If the window state (as seen by explorer.exe) is other than normal, its Easy Link File Viewer state should match what explorer.exe tells us.

Actual behavior It always shows Normal

Additional context I have not tried this with other settings, but I use dark visual theme, font size 10, and only "hide recent" and "remember window size" unchecked. This is on Windows 11 with all updates applied.

Feature request: would it be possible to add the "hidden" state? I notice explorer.exe does not offer that, so I'm assuming "no," but I notice applications (even PowerShell scripting) can request it when starting programs.

ElektroStudios commented 1 week ago

Hi,

The issue with the shortcut's window state not being recognized correctly (Normal, Maximized, Minimized) has been fixed in release 1.6.2. The application now properly reads and respects the window state set in the .lnk file, so the behavior should match what Explorer shows.


Regarding your feature request for the "hidden" window state, unfortunately it seems not possible to directly set this state using the internal Windows interfaces to create a shortcut file.

It's likely that what you're seeing in PowerShell (or with other scripting languages) is the ability to start an application with a "hidden" window state by using specific parameters. PowerShell can achieve this by launching the application and requesting the hidden state programmatically, rather than through the shortcut itself. For example, PowerShell's Start-Process command allows you to specify -WindowStyle Hidden to start a program without showing its window.

Additionally, it's possible that a script might obtain the executable path from the shortcut's attributes and then use that path to start the application with the desired window state.

Feel free to reopen this issue if you have any further questions.

Thanks for your feedback!.