<?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[Pc herunterfahren]]></title><description><![CDATA[<p>Moin</p>
<p>Gibt es in C++ einen Befehl,mit dem man unter Windows den Pc herunterfahren kann?</p>
<p>Mit der Suchfuntion hab ich leider nichts gefunden.</p>
<p>Thx im vorraus <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/142367/pc-herunterfahren</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 05:27:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/142367.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Mar 2006 19:13:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 19:13:34 GMT]]></title><description><![CDATA[<p>Moin</p>
<p>Gibt es in C++ einen Befehl,mit dem man unter Windows den Pc herunterfahren kann?</p>
<p>Mit der Suchfuntion hab ich leider nichts gefunden.</p>
<p>Thx im vorraus <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1026763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026763</guid><dc:creator><![CDATA[schnurres]]></dc:creator><pubDate>Wed, 29 Mar 2006 19:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 19:25:06 GMT]]></title><description><![CDATA[<pre><code>ExitWindowsEx(EWX_POWEROFF+EWX_FORCE, 0);
</code></pre>
<p>Musst dir vorher aber die nötigen Privilegien besorgen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1026774</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026774</guid><dc:creator><![CDATA[Silencium]]></dc:creator><pubDate>Wed, 29 Mar 2006 19:25:06 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 19:27:42 GMT]]></title><description><![CDATA[<p>erstmal Danke für die Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>welche Privilegien muss ich mir besorgen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1026777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026777</guid><dc:creator><![CDATA[schnurres]]></dc:creator><pubDate>Wed, 29 Mar 2006 19:27:42 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 19:29:15 GMT]]></title><description><![CDATA[<p>Nuja... hatte vor ner Woche oder so mal folgendes im MFC Subforum gepostet... funzt einwandfrei:<br />
hier mal zwei mögliche Lösungen:</p>
<pre><code class="language-cpp">// 1. Lösung 
bool MySystemShutdown(void) 
{ 
    ::HANDLE hToken; 
    ::_TOKEN_PRIVILEGES tkp; 

    if(!::OpenProcessToken(::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &amp;hToken)) 
        return false; 

    ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &amp;tkp.Privileges[0].Luid); 

    tkp.PrivilegeCount            = 1; 
    tkp.Privileges[0].Attributes  = SE_PRIVILEGE_ENABLED; 

    ::AdjustTokenPrivileges(hToken, FALSE, &amp;tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); 

    if(::GetLastError() != ERROR_SUCCESS) 
        return false; 

    if(!::ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, SHTDN_REASON_MAJOR_OPERATINGSYSTEM | SHTDN_REASON_FLAG_PLANNED)) 
        return false; 

    return true; 
}
</code></pre>
<pre><code class="language-cpp">// 2. Lösung 
bool SystemShutdown(LPTSTR lpszMessage) 
{ 
    ::HANDLE hToken; 
    ::_TOKEN_PRIVILEGES tkp; 

    if(!::OpenProcessToken(::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &amp;hToken)) 
        return false; 

    ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &amp;tkp.Privileges[0].Luid); 

    tkp.PrivilegeCount        = 1;   
    tkp.Privileges[0].Attributes    = SE_PRIVILEGE_ENABLED; 

    ::AdjustTokenPrivileges(hToken, FALSE, &amp;tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0); 

    if(::GetLastError() != ERROR_SUCCESS) 
        return false; 

    if(!::InitiateSystemShutdown(NULL, lpszMessage, 20, TRUE, FALSE);) 
        return false; 

    tkp.Privileges[0].Attributes = 0; 
    ::AdjustTokenPrivileges(hToken, FALSE, &amp;tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0); 

    return true; 
}
</code></pre>
<p>So... die erste Methode fährt Windows ganz normal herunter... also als ob man selbst den herunterfahren Dlg geöffnet hätte und dort Herunterfahren bestätigthätte...</p>
<p>Das 2. zeigt einen Dlg, der eine Zeit lang dort ist... in diesesn Dlg kannst auch ne Message ausgeben... und nach der Zeit fährt er runter...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1026780</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026780</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 29 Mar 2006 19:29:15 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 20:27:11 GMT]]></title><description><![CDATA[<p>Unter Windows XP kann man auch das Programm shutdown.exe starten:</p>
<pre><code>system(&quot;shutdown.exe -s -t00&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1026827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026827</guid><dc:creator><![CDATA[X-Coder]]></dc:creator><pubDate>Wed, 29 Mar 2006 20:27:11 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Wed, 29 Mar 2006 20:28:31 GMT]]></title><description><![CDATA[<p>Unter Windows XP kann man auch das Programm shutdown.exe starten:</p>
<pre><code class="language-cpp">system(&quot;shutdown.exe -s -t00&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1026828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026828</guid><dc:creator><![CDATA[X-Coder]]></dc:creator><pubDate>Wed, 29 Mar 2006 20:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Thu, 30 Mar 2006 17:13:12 GMT]]></title><description><![CDATA[<p>tja.. wir sind hier aber im WinAPI Forum... system ist nen überbleibsel aus Zeiten in denen man die Konsole benutze... Wenn dann ShellExecute... wobei das noch längst net so sauber ist wie die beiden Lösungen die ich oben gepostet hab <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1027360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1027360</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Thu, 30 Mar 2006 17:13:12 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:30:54 GMT]]></title><description><![CDATA[<p>Hallo...</p>
<p>ich will nen shutdowntimer proggen...soweit so gut...aber...bei der forensuche bin ich auf diesen thread gestoßen, bei dem es ums herunterfahren geht...doch wenn ich den Code den (D)Evil gepostet hat (lösung 1) in mein prog einbaue hagelt es fehlermeldungen ohne ende...</p>
<p>meine frage(n) daher</p>
<p>kann ich diesen code auch in C verwenden oda ist er ausschließlich für C++?</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074654</guid><dc:creator><![CDATA[EXBS]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:30:54 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:44:09 GMT]]></title><description><![CDATA[<p>Sind alles ganz normale WinAPI Funktionen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Zeig mal die Fehlermeldungen...</p>
<p>PS: Nice das de die Forensuche benutzt hast... mal nen vernünftiger Member <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074662</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:44:09 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:45:19 GMT]]></title><description><![CDATA[<p>ausschliesslich in c++ du musst den code zu c portieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074664</guid><dc:creator><![CDATA[General C++]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:51:58 GMT]]></title><description><![CDATA[<p>??? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>ok...danker erstma...</p>
<p>muss ich meinen code anpassen oda den code der gepostet wurde...</p>
<p>naja eigl egal...ich kann nur C und habe keine ahnung wie ich das anpassen sollte <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>aba evtl kennt hier jemand noch eine andere möglichkeit...</p>
<p>ich habe auch das mit</p>
<pre><code class="language-cpp">system(&quot;shutdown.exe -s -t00&quot;);
</code></pre>
<p>probiert aba irgendwie geht das net...</p>
<p>also ich würde mich üpber alles freuen...thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074671</guid><dc:creator><![CDATA[EXBS]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:51:58 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:55:18 GMT]]></title><description><![CDATA[<p>jetzt habe ich ganz vergessen die fehlermeldungen zu posten...ups <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>ok...</p>
<blockquote>
<p>E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:11: error: syntax error before &quot;MySystemShutdown&quot;<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:11: warning: data definition has no type or storage class<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c: In function <code>main': E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:51: warning:</code>return' with a value, in function returning void<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:25: warning: return type of 'main' is not `int'</p>
<p>E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c: At top level:<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:115: error: syntax error before &quot;MySystemShutdown&quot;<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c: In function <code>MySystemShutdown': E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:117: error: syntax error before ':' token E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:120: error: syntax error before ':' token E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:125: error:</code>tkp' undeclared (first use in this function)<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:125: error: (Each undeclared identifier is reported only once<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:125: error: for each function it appears in.)<br />
E:\Downloads\Cstuff\Programme\Shutdowntimer\Shutdowntimer.c:126: error: <code>SE\_PRIVILEGE\_ENABLED' undeclared (first use in this function) E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:128: error: syntax error before ':' token E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:130: error: syntax error before ':' token E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:133: error: syntax error before ':' token E:\\Downloads\\Cstuff\\Programme\\Shutdowntimer\\Shutdowntimer.c:136: error:</code>true' undeclared (first use in this function)</p>
</blockquote>
<p>habe einfach mal alles reingemacht...also meist syntax error aba ich habe den code ja überniommen...wie gesagt ich muss das in C machen...evtl kommen daher die fehler...</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074674</guid><dc:creator><![CDATA[EXBS]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:55:18 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 14:56:24 GMT]]></title><description><![CDATA[<p>Warum lest ihr d*m*e* S*a*t*s nie was man schreibt? Kopier die verd*m*e*n Fehlermeldungen mal hierrein!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074676</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 09 Jun 2006 14:56:24 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 15:13:18 GMT]]></title><description><![CDATA[<p>du musst eine namespace reduktion durchführen da besagtes feature in c so nicht verfügbar ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074684</guid><dc:creator><![CDATA[General C++]]></dc:creator><pubDate>Fri, 09 Jun 2006 15:13:18 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 15:14:03 GMT]]></title><description><![CDATA[<p>Was ich sagen wollte ist du musst die :: überall wegmachen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074686</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074686</guid><dc:creator><![CDATA[General C++]]></dc:creator><pubDate>Fri, 09 Jun 2006 15:14:03 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 20:16:05 GMT]]></title><description><![CDATA[<p>(D)Evil schrieb:</p>
<blockquote>
<p>Warum lest ihr d*m*e* S*a*t*s nie was man schreibt? Kopier die verd*m*e*n Fehlermeldungen mal hierrein!</p>
</blockquote>
<p>??? kA, was du willst...hab doch die fehler gepostet...und die sternechen störn mich beim lesen von was auch imma das sein soll...</p>
<p>@ General C++</p>
<p>habe ich gemacht, also alle &quot;::&quot; wech, allerdings habe ich jetzt imma die fehler meldung</p>
<pre><code class="language-cpp">blabla 'undeclared (first use in this function)
</code></pre>
<p>ok heisst das ich die halt noch deklarieren muss...aba als was?</p>
<p>[fals ihr euch wundert über meinen fragen, bin noch relativ neu auf dem gebiet der programierung]</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074803</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074803</guid><dc:creator><![CDATA[EXBS]]></dc:creator><pubDate>Fri, 09 Jun 2006 20:16:05 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 20:24:39 GMT]]></title><description><![CDATA[<p>Jo... hatte aber schon gepostet als das da noch net stand <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Also... hast de die Header drin.,.. hab die oben garnet dazugeschrieben sehe ich gerade... also... <a href="http://www.msdn.microsoft.com/library/" rel="nofollow">MSDN Library</a> und die Funktionen nachgucken... da steht der Header unten bei,...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074810</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 09 Jun 2006 20:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to Pc herunterfahren on Fri, 09 Jun 2006 20:39:22 GMT]]></title><description><![CDATA[<p>np... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>danke...das hat mir sehr geholfen... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>schönen abend noch</p>
<p>THX <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074821</guid><dc:creator><![CDATA[EXBS]]></dc:creator><pubDate>Fri, 09 Jun 2006 20:39:22 GMT</pubDate></item></channel></rss>