<?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[A question about dark mode, plugins, and an owner-draw ComboBox]]></title><description><![CDATA[<p dir="auto">I’m working on a <a href="https://github.com/Coises/SearchPlusPlus/" rel="nofollow ugc">plugin</a> and I have a couple questions about dark mode. I’m hoping someone who reads this will know the answers. I have looked at the code, but I don’t really follow everything it’s doing.</p>
<p dir="auto">My Settings dialog uses a ComboBox with style:</p>
<p dir="auto">CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP</p>
<p dir="auto">I’m sending an NPPM_DARKMODESUBCLASSANDTHEME message with wParam = NppDarkMode::dmfInit at the end of my WM_INITDIALOG process in the hopes of not antagonizing users who have dark mode enabled.</p>
<p dir="auto">The ComboBox is fine in light mode but it is messed up in dark mode.</p>
<ul>
<li>
<p dir="auto">Am I correct in thinking that the dark mode subclass process does not support owner-draw combo boxes?</p>
</li>
<li>
<p dir="auto">Is there a way to exempt just that one control from the processing and try to figure out myself how to set the right colors, or do I need to drop the NPPM_DARKMODESUBCLASSANDTHEME message and either stay in light mode or handle all of the dark mode processing in my code? (Staying in light mode is an option; it’s not like users have the Settings dialog open all the time. The main dialog, fortunately, doesn’t seem to have any controls the dark mode handler doesn’t like. Yet. But I may need to go to owner-draw buttons at some point, and perhaps they will have the same problem.)</p>
</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/topic/27486/a-question-about-dark-mode-plugins-and-an-owner-draw-combobox</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 02:55:19 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/27486.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Apr 2026 22:51:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to A question about dark mode, plugins, and an owner-draw ComboBox on Sat, 04 Apr 2026 05:20:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/24325">@rdipardo</a> said in <a href="/post/105166">A question about dark mode, plugins, and an owner-draw ComboBox</a>:</p>
<blockquote>
<p dir="auto">Try passing the control’s handle to the <code>::SetWindowTheme</code> function provided by the <a href="https://learn.microsoft.com/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme" rel="nofollow ugc"><code>uxtheme</code> header</a>, using <code>L"DarkMode_CFD"</code> as the <code>pszSubAppName</code>; to restore light mode, call it with the same arguments, but change <code>pszSubAppName</code> to a null pointer.</p>
</blockquote>
<p dir="auto">Thanks, Robert. At first attempt, this doesn’t appear to solve <a href="https://community.notepad-plus-plus.org/post/105148">the problem</a>.</p>
<p dir="auto">The colors are right with just NPPM_DARKMODESUBCLASSANDTHEME; the problem is that the static control shows unknown text instead of the selected drop-down entry, and attempting to select from the drop-down produces bizarre highlighting and tracking instead of what is expected (and still doesn’t set the static control). Adding the SetWindowTheme call doesn’t change that. Removing NPPM_DARKMODESUBCLASSANDTHEME, of course, makes everything else light, and for the control in question, SetWindowTheme only seems to change the drop-down chevron. Interestingly, NPPM_DARKMODESUBCLASSANDTHEME <em>does</em> get all the colors right, including in the owner-drawn drop-down; it just breaks the functionality in the process.</p>
<p dir="auto">The problem goes away entirely if I remove the CBS_OWNERDRAWFIXED style (but then, of course, it doesn’t display as intended, showing the color associated with each indicator that can be selected). That’s why I feel like the problem is most likely to do with the sub-classing. I can’t find any clear documentation on how all that works. I don’t even know <em>why</em> the controls are being sub-classed, and not just themed. Maybe there is a way to exempt that control from sub-classing, and do whatever it is that the sub-classing does in my own code?</p>
<p dir="auto">A pointer to actual documentation on this design, how it works and how it is meant to be used would be wonderful, but I’m guessing no such thing exists. :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/105167</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/105167</guid><dc:creator><![CDATA[Coises]]></dc:creator><pubDate>Sat, 04 Apr 2026 05:20:05 GMT</pubDate></item><item><title><![CDATA[Reply to A question about dark mode, plugins, and an owner-draw ComboBox on Sat, 04 Apr 2026 04:34:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27184">@Coises</a> said in <a href="/post/105163">A question about dark mode, plugins, and an owner-draw ComboBox</a>:</p>
<blockquote>
<p dir="auto">The ComboBox is fine in light mode but it is messed up in dark mode.</p>
</blockquote>
<p dir="auto">Try passing the control’s handle to the <code>::SetWindowTheme</code> function provided by the <a href="https://learn.microsoft.com/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme" rel="nofollow ugc"><code>uxtheme</code> header</a>, using <code>L"DarkMode_CFD"</code> as the <code>pszSubAppName</code>; to restore light mode, call it with the same arguments, but change <code>pszSubAppName</code> to a null pointer.</p>
<p dir="auto"><em>Credit goes to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/33225">@klaus101</a> for identifying the (undocumented) dark theme’s name in <a href="https://community.notepad-plus-plus.org/post/98820">this post</a>.</em></p>
<p dir="auto"><em><strong>P.S.</strong> The drop-down list background color may still need to be owner-drawn with an appropriate color. The only functional example I can provide is in <a href="https://github.com/rdipardo/nppFSIPlugin/blob/42704ab3aa6b2f51342cd66f2e39f355d31a5f44/Source/Plugin/Forms/ConfigForm.pas#L433" rel="nofollow ugc">Free Pascal</a>, so YMMV.</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/105166</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/105166</guid><dc:creator><![CDATA[rdipardo]]></dc:creator><pubDate>Sat, 04 Apr 2026 04:34:14 GMT</pubDate></item></channel></rss>