<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: Restart service on resolution change</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=ed449f7c-6b81-49db-afa0-b41c98748f16" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=ed449f7c-6b81-49db-afa0-b41c98748f16</link>
<description>DisplayFusion RSS: Restart service on resolution change</description>
<lastBuildDate>Sat, 10 Oct 2026 11:57:37 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=ed449f7c-6b81-49db-afa0-b41c98748f16</generator>
<item>
<title>RE: Restart service on resolution change</title>
<link>https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16#3</link>
<pubDate>Tue, 14 Mar 2023 14:51:03 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Is DisplayFusion running as administrator? To do this, you would need to create a .exe that can elevate, and then call it, as we can't elevate scripts.]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Is DisplayFusion running as administrator? To do this, you would need to create a .exe that can elevate, and then call it, as we can't elevate scripts.
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Restart service on resolution change</title>
<link>https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16#2</link>
<pubDate>Sat, 11 Mar 2023 22:19:33 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I tried using something like this but it doesn't seem to work even if I add the .NET reference to System.ServiceProcess.dll
Code
Copy
Select All
using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;using System.Management;&#xA;using System.ServiceProcess;&#xA;&#xA;//Cod...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I tried using something like this but it doesn't seem to work even if I add the .NET reference to System.ServiceProcess.dll<br/>
<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a125acff8e7365aa1d81bffb03feb0" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a125acff8e7365aa1d81bffb03feb0Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a125acff8e7365aa1d81bffb03feb0Js" name="code01a125acff8e7365aa1d81bffb03feb0Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;using System.Management;&#xA;using System.ServiceProcess;&#xA;&#xA;//Code brought to you by: solaris765&#xA;//Because numbers after my screen name are fun.&#xA;//Automatically changes Monitor Profile based on resolution changes.&#xA;//&#xA;// The &#x27;windowHandle&#x27; parameter will contain the window handle for the:&#xA;// - Active window when run by hotkey&#xA;// - Window Location target when run by a Window Location rule&#xA;// - TitleBar Button owner when run by a TitleBar Button&#xA;// - Jump List owner when run from a Taskbar Jump List&#xA;// - Currently focused window if none of these match&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        int maxHRes = getMaxResolution();&#xA;        BFS.Dialog.ShowMessageInfo(maxHRes.ToString());&#xA;&#xA;        // default Resolution&#xA;        if (maxHRes == 1920)&#xA;        {&#xA;        RestartService(&quot;Start11&quot;);&#xA;        }&#xA;&#xA;        // nVidia Surround / AMD Eyefinity&#xA;        else if (maxHRes &amp;gt; 1920)&#xA;        {&#xA;        RestartService(&quot;Start11&quot;);&#xA;        }&#xA;    }&#xA;&#xA;    public static int getMaxResolution()&#xA;    {&#xA;        //Must include: using System.Management;&#xA;&#xA;        ManagementScope scope = new ManagementScope();&#xA;&#xA;        ObjectQuery query = new ObjectQuery(&quot;SELECT * FROM CIM_VideoControllerResolution&quot;);&#xA;        int hRes = 0;&#xA;        using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))&#xA;        {&#xA;            ManagementObjectCollection results = searcher.Get();&#xA;&#xA;            int temp;&#xA;            foreach (ManagementBaseObject result in results)&#xA;            {&#xA;                temp = Convert.ToInt32(result[&quot;HorizontalResolution&quot;]);&#xA;                if (temp &amp;gt; hRes)&#xA;                hRes = temp;&#xA;            }&#xA;        }&#xA;        return hRes;&#xA;    }&#xA;&#xA;    public static void RestartService(string serviceName)&#xA;    {&#xA;        ServiceController service = new ServiceController(serviceName);&#xA;&#xA;        if (service.Status == ServiceControllerStatus.Running)&#xA;        {&#xA;            service.Stop();&#xA;            service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));&#xA;        }&#xA;&#xA;        service.Start();&#xA;        service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));&#xA;    }&#xA;}</pre><textarea id="code01a125acff8e7365aa1d81bffb03feb0" name="code01a125acff8e7365aa1d81bffb03feb0" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>Restart service on resolution change</title>
<link>https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16</link>
<pubDate>Sat, 11 Mar 2023 19:48:13 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/restart-service-on-resolution-change/?ID=ed449f7c-6b81-49db-afa0-b41c98748f16</guid>
<category>DisplayFusion</category>
<description><![CDATA[Is there a way to have DisplayFusion restart a Windows service when the screen resolution changes or a monitor is connected?]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Is there a way to have DisplayFusion restart a Windows service when the screen resolution changes or a monitor is connected?
</div>
]]></content:encoded>
</item>
</channel>
</rss>