<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Service on Remko's Blog</title><link>https://remkoweijnen.nl/blog/tags/service/</link><description>Recent content in Service on Remko's Blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 28 Nov 2012 12:20:40 +0000</lastBuildDate><atom:link href="https://remkoweijnen.nl/blog/tags/service/index.xml" rel="self" type="application/rss+xml"/><item><title>Get Process Id of a running Service</title><link>https://remkoweijnen.nl/blog/2012/11/28/get-process-id-of-a-running-service/</link><pubDate>Wed, 28 Nov 2012 12:20:40 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/11/28/get-process-id-of-a-running-service/</guid><description>&lt;p&gt;Sometimes you need to know the Process Id (PID) of a running service. Since Windows 2003 you can use the tasklist.exe tool with the /SVC switch. But how to do this programmatically?&lt;/p&gt; &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/ms684941%28VS.85%29.aspx"&gt;QueryServiceStatusE&lt;/a&gt;x API returns a &lt;a href="http://msdn.microsoft.com/en-us/library/ms685992(v=vs.85).aspx"&gt;SERVICE_STATUS_PROCESS&lt;/a&gt; structure that contains the PID.&lt;/p&gt;</description></item></channel></rss>