<?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[Access NPP command-line from plugin]]></title><description><![CDATA[<p dir="auto">I want my plugin to handle a custom command line parameter.</p>
<p dir="auto">I can use the <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/pull/4620" rel="nofollow ugc">undocumented -z parameter</a> that <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> kindly nudged me toward.</p>
<p dir="auto">For -multiInst I can get the NPP command line from Win32 API (<a href="https://docs.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getcommandlinew" rel="nofollow ugc">GetCommandLineW</a>), but for mono-instances that will only work for the initial launch.</p>
<p dir="auto">It seems that mono-instance works on subsequent launches by sending the command line parameters to the first NPP instance via WM_COPYDATA message.</p>
<p dir="auto">Unfortunately WM_COPYDATA doesn’t appear to be forwarded to plugins “messageProc” by _pluginsManager.relayNppMessages().</p>
<p dir="auto">Worse - currently NPP strips out the -z (+ next) parameter and doesn’t add them to the WM_COPYDATA message, so it’s not even worth hooking it directly.</p>
<p dir="auto">I think the best solution might be to implement a new NPPN Notfication something like NPPN_PARAMETERS_CHANGED?</p>
<p dir="auto">Is this worth my while investigating and maybe raising a pull request?</p>
<p dir="auto"><strong>Or is there a better way!?</strong></p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19618/access-npp-command-line-from-plugin</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 10:33:54 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19618.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 27 Jun 2020 19:35:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Access NPP command-line from plugin on Sun, 28 Jun 2020 20:04:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a></p>
<p dir="auto">yes I see, I guess some kind of notification, as you wrote, is needed here.<br />
The wording NPPN_PARAMETERS_CHANGED might be a bit misleading<br />
as the mono-instance is still reporting its parameters correctly.<br />
Maybe NPPN_DIFFERENT_INSTANCE_MERGED?<br />
Native speakers - what do you suggest? :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55402</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55402</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sun, 28 Jun 2020 20:04:37 GMT</pubDate></item><item><title><![CDATA[Reply to Access NPP command-line from plugin on Sun, 28 Jun 2020 03:44:27 GMT]]></title><description><![CDATA[<p dir="auto">Apologies - I was trying to describe how NPP implements mono-instance mode…<br />
Example…</p>
<ul>
<li>Enable ‘mono-instance’ mode &amp; close all NPP instances</li>
<li>Launch NPP <code>notepad++.exe xyz.txt</code>
<ul>
<li>Process ID = 123</li>
<li>GetCommandLineW correctly shows <code>notepad++.exe xyz.txt</code></li>
</ul>
</li>
<li>Launch 2nd NPP instance <code>notepad++.exe -z -test abc.txt</code>
<ul>
<li>Process ID = 234</li>
<li>NPP 234 detects Mutex from NPP 123</li>
<li>sends WM_COPYDATA to NPP 123 containing ‘abc.txt’</li>
<li>kills self (234)</li>
</ul>
</li>
<li>NPP 123 receives WM_COPYDATA
<ul>
<li>Opens ‘abc.txt’ alongside ‘xyz.txt’</li>
<li>GetCommandLineW still just shows <code>notepad++.exe  xyz.txt</code></li>
</ul>
</li>
</ul>
<p dir="auto">How can I get the “-z -test” parameters from the plugin running in the mono-instanced NPP 123?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55383</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55383</guid><dc:creator><![CDATA[moon6969]]></dc:creator><pubDate>Sun, 28 Jun 2020 03:44:27 GMT</pubDate></item><item><title><![CDATA[Reply to Access NPP command-line from plugin on Sat, 27 Jun 2020 21:17:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a></p>
<p dir="auto">sorry, but I don’t understand how you can start multiple mono-instances?<br />
What did I miss?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55382</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55382</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 27 Jun 2020 21:17:02 GMT</pubDate></item></channel></rss>