Issues with SVG files, and opening from File Explorer
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Re: Issues with SVG files, and opening from File Explorer
My notes claim I was using TextPad back in 1997 and maybe before then.
Frustrating when an old, reliable tool misbehaves for no apparent reason, isn't it.
I blame Windows 11, myself. I dread having to "upgrade" from Windows 10.
Also, putting all sorts of "magic" in the registry was one of the worst decisions that Microsoft ever made.
You can't beat a nice low-tech, human-readable .INI file.
Frustrating when an old, reliable tool misbehaves for no apparent reason, isn't it.
I blame Windows 11, myself. I dread having to "upgrade" from Windows 10.
Also, putting all sorts of "magic" in the registry was one of the worst decisions that Microsoft ever made.
You can't beat a nice low-tech, human-readable .INI file.
Re: Issues with SVG files, and opening from File Explorer
These are the relevant entries that TextPad's installer writes to the registry to enable File Explorer to request that it opens a file which has been double clicked:
If you installed TextPad for the current user, rather than all users, the path to "Applications" will start with HKEY_CURRENT_USER.
Essentially, File Explorer looks up the associated application in the registry, then checks how that application should be started and informed of the file to open by looking for the it under the key "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications". If it has a "shell\open\ddeexec" subkey, it proceeds by sending it DDE messages. For "TextPad.exe", first, it broadcasts a message containing "system" and "TextPad.9" to all running applications that have registered to receive such messages. If it gets no response, after a timeout, it executes the command under "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\command" and gives it time to start. Then it sends a message with the command "open" and the name of the file as a parameter for each file to open. As file names are sent one at a time, there is no issue with spaces in their names.
I wondered if the timeouts were too short, so I tested it on an old PC which runs Windows 10 painfully slowly, but it worked as expected.
Please will you run regedit.exe and check that those entries are correct.
Code: Select all
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\TextPad.exe
C:\Program Files\TextPad\TextPad.exe
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\command
"C:\Program Files\TextPad\TextPad.exe" -s
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\ddeexec\application
TextPad.9
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\ddeexec\topic
system
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\MultiSelectModel
player
Essentially, File Explorer looks up the associated application in the registry, then checks how that application should be started and informed of the file to open by looking for the it under the key "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications". If it has a "shell\open\ddeexec" subkey, it proceeds by sending it DDE messages. For "TextPad.exe", first, it broadcasts a message containing "system" and "TextPad.9" to all running applications that have registered to receive such messages. If it gets no response, after a timeout, it executes the command under "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\TextPad.exe\shell\open\command" and gives it time to start. Then it sends a message with the command "open" and the name of the file as a parameter for each file to open. As file names are sent one at a time, there is no issue with spaces in their names.
I wondered if the timeouts were too short, so I tested it on an old PC which runs Windows 10 painfully slowly, but it worked as expected.
Please will you run regedit.exe and check that those entries are correct.
Re: Issues with SVG files, and opening from File Explorer
While this may work best when f.e. I select multiple files in the Explorer to then shell select "Open" or "Open with..." for decades the way to make your program single instance only was:
- to simply create a Mutex at the start and
- then check if it already existed:
- in that case just make inter-process communication to inform your other instance which additional file(s) should be opened (f.e. by using a custom message which the recently started program sends to the already running one)
- and then just exit running.
Re: Issues with SVG files, and opening from File Explorer
That is how TextPad handles multiple instances, and you can get File Explorer to start a new instance of TextPad for each file by deleting the ddeexec stuff in the registry and changing the open command to pass in the filename using "%1" as a parameter, like Notepad does.
Re: Issues with SVG files, and opening from File Explorer
No, Notepad doesn't use Mutexes and/or doesn't forward file opening requests to the already running instance to then close its second instance right away. Did Windows 11 really change this?
Re: Issues with SVG files, and opening from File Explorer
Notepad on Windows 10 doesn't need to use a mutex, as it always opens each file in a separate instance. (Not sure about the Notepad app on Windows 11 which can open multiple files on separate tabs.) Sorry if my explanation of the way TextPad can be made to behave like Notepad, rather than use DDE messages, confused you.
Re: Issues with SVG files, and opening from File Explorer
Oh, you confirmed that TextPad does use/used a mutex already. I interpreted your post as being exclusive, like "the DDE is like a mutex", instead of being an addition that already exists in the background in case DDE fails to work as expected. I now understood it this way (and am glad it's already implemented):
(Only the blue part covers the Notepad example - Notepad isn't meant as example for everything. The red words would have made it more unambiguous to me.)
Re: Issues with SVG files, and opening from File Explorer
@bbadmin: I have installed Textpad for all users and the registry entries are identical.
An attempt with %1 showed slight success. Opening without a file no longer happened so often.
An attempt with %1 showed slight success. Opening without a file no longer happened so often.
Re: Issues with SVG files, and opening from File Explorer
@MrSpock: to allow for spaces in file pathnames, put the %1 in the registry in quotes.
Assuming that was not an issue, if TextPad is started with the name of a file in its parameters, it will either open it, or ask if you want to create it. Try it for yourself by running these commands in a command prompt window:
If you repeat the second command, does it consistently start and open the file?
You can use procmon to check that TextPad receives such a parameter when invoked by File Manager. After downloading and installing it, run procmon64.exe and add a process name filter that includes textpad.exe and excludes the registry and file system event classes. Click OK and right click the first instance of textpad.exe in the list and select Properties. That will show the command line TextPad was started with.
Assuming that was not an issue, if TextPad is started with the name of a file in its parameters, it will either open it, or ask if you want to create it. Try it for yourself by running these commands in a command prompt window:
Code: Select all
"C:\Program Files\TextPad\TextPad.exe" junk
"C:\Program Files\TextPad\TextPad.exe" "C:\Program Files\TextPad\Readme\Readme.txt"
You can use procmon to check that TextPad receives such a parameter when invoked by File Manager. After downloading and installing it, run procmon64.exe and add a process name filter that includes textpad.exe and excludes the registry and file system event classes. Click OK and right click the first instance of textpad.exe in the list and select Properties. That will show the command line TextPad was started with.
Re: Issues with SVG files, and opening from File Explorer
OK, with %1 in quotation marks it seems to work. No longer had an empty view when opening a file several times.
I would consider this part of my post done.
There is still the problem with the SVG files.
I would consider this part of my post done.
There is still the problem with the SVG files.
Re: Issues with SVG files, and opening from File Explorer
@MrSpock: thanks for confirming.
Please note that the installer will reset those registry entries after any updates. You might want to use regedit to export that section to make it easy to reinstate later.
It's not possible to mix bitmaps with vector graphics, so I can't help with your SVG issue. TextPad 8 still uses bitmaps in its toolbars, but it cannot read any workspace files created with version 9.
It is possible to get a list of the files open in a workspace using the Edit/Copy Other/All File Names command. That can be pasted into a document and saved as a file which can be used as an @-file to open them all in another version of TextPad.
Please note that the installer will reset those registry entries after any updates. You might want to use regedit to export that section to make it easy to reinstate later.
It's not possible to mix bitmaps with vector graphics, so I can't help with your SVG issue. TextPad 8 still uses bitmaps in its toolbars, but it cannot read any workspace files created with version 9.
It is possible to get a list of the files open in a workspace using the Edit/Copy Other/All File Names command. That can be pasted into a document and saved as a file which can be used as an @-file to open them all in another version of TextPad.
Re: Issues with SVG files, and opening from File Explorer
I have now succeeded in converting PNG files into SVG. On the website https://www.freeconvert.com you can convert 20 icons every day for free. However, they should have about 250 pixels so that the quality is appealing.