I am not sure how notepad++ does it.

I would guess that it determines it cannot write to the folder on save and then
offers to re-open in admin mode.

The message says 

"This file cannot be saved and it may be protected.
Do you want to launch Notepad++ in Administrator mode?" 

If you say yes, then it UAC is opened and Notepad++ closes, and reopens in admin
mode without losing any changes to the file you were working on.

I did try a read only file and this was greyed out and editing locked out so the
file attributes are checked first.

I then tried a domain file that I made without write access and as expected
Notepad++ offered admin mode and then of course still could not save to the
location.

I think this is reasonable behaviour, as an admin I know when I need domain
rights vs UAC but often forget to raise an editor to UAC.

One last interesting point is the following on a domain protected file.

1. PSPad errors with unable to save changes to file. (reasonable)
2. Notepad++ after raising to admin just doesn't save and gives not error either
(bad).
3. Notepad (included in windows) knows it can't save the changes so pops up a
new filename save window (probably best).

-- 
<https://forum.pspad.com/read.php?2,71648,76219>
PSPad freeware editor https://www.pspad.com

Odpovedet emailem