<?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/"
	>

<channel>
	<title>JEDI Windows API &#187; Laptop</title>
	<atom:link href="http://blog.delphi-jedi.net/tag/laptop/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.delphi-jedi.net</link>
	<description>Joint Endeavor of Delphi Innovators of Windows Programming</description>
	<lastBuildDate>Wed, 19 Oct 2011 18:52:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>You cannot make your application undestroyable.</title>
		<link>http://blog.delphi-jedi.net/2008/03/17/you-cant-make-your-application-undestroyable/</link>
		<comments>http://blog.delphi-jedi.net/2008/03/17/you-cant-make-your-application-undestroyable/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 22:24:57 +0000</pubDate>
		<dc:creator>Christian Wimmer</dc:creator>
				<category><![CDATA[JEDI Windows API Headers]]></category>
		<category><![CDATA[JWA]]></category>
		<category><![CDATA[KillProcess]]></category>
		<category><![CDATA[Laptop]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[TerminateProcess]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.delphi-jedi.net/2008/03/17/you-cant-make-your-application-undestroyable/</guid>
		<description><![CDATA[The people from Microsoft decided that the user has to be in full control over the computer. So there is no assured way to make a program user resistant. She can always use TerminateProcess to forcibly kill the process. uses JwaWindows; function KillProcess&#40;const ProcessID : DWord&#41;: Boolean; var &#160; hProcess: HANDLE; begin &#160; hProcess := [...]]]></description>
			<content:encoded><![CDATA[<p>The people from Microsoft decided that the user has to be in full control over the computer. So there is no assured way to make a program user resistant. She can always use <a href="http://msdn2.microsoft.com/en-us/library/ms686714.aspx" title="Go to MSDN.">TerminateProcess</a> to forcibly kill the process.</p>
<p><span id="more-76"></span></p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">uses</span> JwaWindows;</p>
<p><span class="kw1">function</span> KillProcess<span class="br0">&#40;</span><span class="kw1">const</span> ProcessID : <span class="kw4">DWord</span><span class="br0">&#41;</span>: <span class="kw4">Boolean</span>;<br />
<span class="kw1">var</span><br />
&nbsp; hProcess: HANDLE;<br />
<span class="kw1">begin</span><br />
&nbsp; hProcess := OpenProcess<span class="br0">&#40;</span>PROCESS_TERMINATE, &nbsp;<span class="kw2">False</span>, ProcessID<span class="br0">&#41;</span>;<br />
&nbsp; Result := TerminateProcess<span class="br0">&#40;</span>hProcess, <span class="nu0">0</span><span class="br0">&#41;</span>;<br />
<span class="kw1">end</span>;</div>
<p>Because nobody reads the remarks section of <a href="http://msdn2.microsoft.com/en-us/library/ms686714.aspx" title="Go to MSDN.">TerminateProcess</a>, I cite it here.</p>
<blockquote><p>The  <strong>TerminateProcess</strong> function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if <strong>TerminateProcess</strong> is used rather than  <a href="http://msdn2.microsoft.com/en-us/library/ms682658%28VS.85%29.aspx" onclick="javascript:Track('ctl00_rs1_mainContentContainer_ctl00|ctl00_rs1_mainContentContainer_ctl06',this);" id="ctl00_rs1_mainContentContainer_ctl06"><strong>ExitProcess</strong></a>.</p>
<p><strong>TerminateProcess</strong> initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.</p></blockquote>
<p><strong>And remind this little sentence.</strong></p>
<blockquote><p>A process cannot prevent itself from being terminated.</p></blockquote>
<p>However there are some reasons <u>not to make your application undestroyable</u>.</p>
<ol>
<li>The users don&#8217;t want it.</li>
<li>The work does not pay off. The user is going to close the app anyway.</li>
<li>Some people complain about apps that do not close when Windows is shutting down.</li>
<li>It&#8217;s also said that there were laptops which didn&#8217;t shutdown. The users put them into their bags and didn&#8217;t realize that the machine overheated eventually.</li>
<li>Vista closes your application in the end you have no veto.</li>
</ol>
<p><strong>Tell me how you liked this blog entry by adding a comment.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.delphi-jedi.net/2008/03/17/you-cant-make-your-application-undestroyable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

