<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Howto close current file &#x2F; editor witout savequestion]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">i programming a litle plugin on C#.</p>
<p dir="auto">How can i close the current file / editor without question for save changing?</p>
<p dir="auto">regards Mario</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19020/howto-close-current-file-editor-witout-savequestion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 21:40:57 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19020.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Mar 2020 19:29:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 21:06:39 GMT]]></title><description><![CDATA[<p dir="auto">@ all</p>
<p dir="auto">i have found a solution:</p>
<pre><code>IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());
editor.SetSavePoint();
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_MENUCOMMAND, 0, NppMenuCmd.IDM_FILE_CLOSE);
</code></pre>
<p dir="auto">work wit current tab.<br />
thanks for inspiration</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51207</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51207</guid><dc:creator><![CDATA[MarioRosi]]></dc:creator><pubDate>Fri, 06 Mar 2020 21:06:39 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 21:06:42 GMT]]></title><description><![CDATA[<p dir="auto">Oh, ok - you need to use SendMessage and menuCommand enums.<br />
From python this is like</p>
<pre><code>def close(self) -&gt; None:    # done
    ''' Closes the currently active document '''
    self.menuCommand(MENUCOMMAND.FILE_CLOSE)

def menuCommand(self, commandID: int) -&gt; None:   # done
    ''' Runs a Notepad++ menu command - just pass the commandID '''
    self.__npp_send(NPPM_MENUCOMMAND, 0, commandID)

def __npp_send(self, message: int, wparam: int=0, lparam: int=0) -&gt; int:  # done
    ''' internal function used to send npp messages to npp '''
    result = user32.SendMessageW(self.hwnd, message, wparam, lparam)
    return result
</code></pre>
<p dir="auto">WM_USER = 1024<br />
NPPMSG = WM_USER + 1000<br />
NPPM_MENUCOMMAND = NPPMSG + 48</p>
<p dir="auto">IDM = 40000<br />
FILE = IDM + 1000<br />
FILE_NEW = FILE + 1<br />
FILE_OPEN = FILE + 2<br />
FILE_CLOSE = FILE + 3</p>
<p dir="auto">MENUCOMMAND.FILE_CLOSE = IDM + FILE +3</p>
<p dir="auto">self.hwnd is the handle from npp that you get via  setInfo callback</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51206</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51206</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 06 Mar 2020 21:06:42 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 20:58:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<pre><code>IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());
editor.SetSavePoint();
</code></pre>
<p dir="auto">works and set the document ans unchanged.</p>
<p dir="auto">but how close the document “notepad.close” dosnt exist.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51205</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51205</guid><dc:creator><![CDATA[MarioRosi]]></dc:creator><pubDate>Fri, 06 Mar 2020 20:58:19 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 20:55:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/17930">@MarioRosi</a></p>
<p dir="auto">Then I would say use the c# equivalent messages to my pythonscript example.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51204</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51204</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 06 Mar 2020 20:55:03 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 20:40:56 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<blockquote>
<p dir="auto">do you want to discard the changes or to always save it?</p>
</blockquote>
<p dir="auto">yes i want discard all changes and close only the file, not the notepad.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51203</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51203</guid><dc:creator><![CDATA[MarioRosi]]></dc:creator><pubDate>Fri, 06 Mar 2020 20:40:56 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 19:50:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<blockquote>
<p dir="auto">editor.setSavePoint()</p>
</blockquote>
<p dir="auto">Never noticed that one; I’ll have to give it a try! :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51200</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51200</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 06 Mar 2020 19:50:54 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 19:49:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> said in <a href="/post/51196">Howto close current file / editor witout savequestion</a>:</p>
<blockquote>
<p dir="auto">Anyway, what I do in a P.S. is, since you are discarding changes anyway, is execute repetitive “undo” operations until you get the file back to an unmodified state.</p>
</blockquote>
<p dir="auto">Maybe I’m wrong but shouldn’t this work to discard the changes?</p>
<pre><code>editor.setSavePoint()
notepad.close()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/51198</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51198</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 06 Mar 2020 19:49:52 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 19:45:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/17930">@MarioRosi</a></p>
<p dir="auto">Being a Pythonscript programmer, and having wanted to do the same type of thing in the past, I didn’t really find that it is possible in P.S., but maybe with a true plugin it IS possible?</p>
<p dir="auto">Anyway, what I do in a P.S. is, since you are discarding changes anyway, is execute repetitive “undo” operations until you get the file back to an unmodified state.  Then it can be closed without Notepad++ prompting for anything.</p>
<p dir="auto">Of course, if you want to save the changes, what I do via P.S. is a “save” and then the “close” on the file.  There should be something mimicing that for true plugins.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51196</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51196</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 06 Mar 2020 19:45:53 GMT</pubDate></item><item><title><![CDATA[Reply to Howto close current file &#x2F; editor witout savequestion on Fri, 06 Mar 2020 19:44:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/17930">@MarioRosi</a></p>
<p dir="auto">do you want to discard the changes or to always save it?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51195</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51195</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 06 Mar 2020 19:44:07 GMT</pubDate></item></channel></rss>