<?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[Fehlerhafter Script um Prozesse anzuzeigen]]></title><description><![CDATA[<p>Hi,</p>
<p>Habe einen Script gefunden der mir alle Prozesse und Threads anzeigen soll die im Moment so laufen (im Prinzip etwas ähnliches wie der Taskmanager). Als ich den Script im Compiler eingegeben habe, habe ich beim Debuggen diverse Errormeldungen bekommen. Woher kommt das? der Script müsste eigentlich funktionieren...<br />
Kann sich den jemand mal anschauen?^^</p>
<pre><code class="language-csharp">#include &lt;windows.h&gt; 
#include &lt;tlhelp32.h&gt;  
#include &lt;iostream&gt; 

using namespace std; 

typedef BOOL (WINAPI *TH32_PROCESS)  
             (HANDLE hSnapShot, LPPROCESSENTRY32 lppe); 

static TH32_PROCESS pProcess32First = NULL;  
static TH32_PROCESS pProcess32Next = NULL; 

int main() 
{ 
   PROCESSENTRY32 pe32 = { 0 }; 
   HANDLE hSnapshot    = NULL; 

   HINSTANCE hDll = LoadLibrary(&quot;kernel32.dll&quot;); 

   pProcess32First=(TH32_PROCESS)GetProcAddress(hDll,&quot;Process32First&quot;); 
   pProcess32Next=(TH32_PROCESS)GetProcAddress(hDll,&quot;Process32Next&quot;); 

   hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);               
   if (hSnapshot != (HANDLE) -1) 
   { 
pe32.dwSize = sizeof (PROCESSENTRY32); 
int proc_cnt=0,thrd_cnt=0; 

if (pProcess32First (hSnapshot, &amp;pe32)) 
{ 
    cout&lt;&lt;&quot;Name\t\t\t\tThreads&quot;&lt;&lt;endl&lt;&lt;endl; 
    do 
    { 
        thrd_cnt+=pe32.cntThreads; 
proc_cnt++; 

cout&lt;&lt;&quot;  &quot;&lt;&lt;&quot;\t\t\t\t&quot;&lt;&lt;pe32.cntThreads 
    &lt;&lt;&quot;\r&quot;&lt;&lt;pe32.szExeFile&lt;&lt;endl; 

    } 
    while(pProcess32Next (hSnapshot, &amp;pe32)); 

} 

        cout&lt;&lt;endl 
   &lt;&lt;&quot;Threads:  &quot;&lt;&lt;thrd_cnt&lt;&lt;endl 
   &lt;&lt;&quot;Prozesse: &quot;&lt;&lt;proc_cnt&lt;&lt;endl; 

CloseHandle (hSnapshot);  
   } 

   cin.get(); 
   return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/197757/fehlerhafter-script-um-prozesse-anzuzeigen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 12:14:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/197757.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Nov 2007 14:26:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:26:42 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Habe einen Script gefunden der mir alle Prozesse und Threads anzeigen soll die im Moment so laufen (im Prinzip etwas ähnliches wie der Taskmanager). Als ich den Script im Compiler eingegeben habe, habe ich beim Debuggen diverse Errormeldungen bekommen. Woher kommt das? der Script müsste eigentlich funktionieren...<br />
Kann sich den jemand mal anschauen?^^</p>
<pre><code class="language-csharp">#include &lt;windows.h&gt; 
#include &lt;tlhelp32.h&gt;  
#include &lt;iostream&gt; 

using namespace std; 

typedef BOOL (WINAPI *TH32_PROCESS)  
             (HANDLE hSnapShot, LPPROCESSENTRY32 lppe); 

static TH32_PROCESS pProcess32First = NULL;  
static TH32_PROCESS pProcess32Next = NULL; 

int main() 
{ 
   PROCESSENTRY32 pe32 = { 0 }; 
   HANDLE hSnapshot    = NULL; 

   HINSTANCE hDll = LoadLibrary(&quot;kernel32.dll&quot;); 

   pProcess32First=(TH32_PROCESS)GetProcAddress(hDll,&quot;Process32First&quot;); 
   pProcess32Next=(TH32_PROCESS)GetProcAddress(hDll,&quot;Process32Next&quot;); 

   hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);               
   if (hSnapshot != (HANDLE) -1) 
   { 
pe32.dwSize = sizeof (PROCESSENTRY32); 
int proc_cnt=0,thrd_cnt=0; 

if (pProcess32First (hSnapshot, &amp;pe32)) 
{ 
    cout&lt;&lt;&quot;Name\t\t\t\tThreads&quot;&lt;&lt;endl&lt;&lt;endl; 
    do 
    { 
        thrd_cnt+=pe32.cntThreads; 
proc_cnt++; 

cout&lt;&lt;&quot;  &quot;&lt;&lt;&quot;\t\t\t\t&quot;&lt;&lt;pe32.cntThreads 
    &lt;&lt;&quot;\r&quot;&lt;&lt;pe32.szExeFile&lt;&lt;endl; 

    } 
    while(pProcess32Next (hSnapshot, &amp;pe32)); 

} 

        cout&lt;&lt;endl 
   &lt;&lt;&quot;Threads:  &quot;&lt;&lt;thrd_cnt&lt;&lt;endl 
   &lt;&lt;&quot;Prozesse: &quot;&lt;&lt;proc_cnt&lt;&lt;endl; 

CloseHandle (hSnapshot);  
   } 

   cin.get(); 
   return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1403117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403117</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:38:58 GMT]]></title><description><![CDATA[<p>wenn du ein CMD Fenster aufmachst, kannst du mit dem Befehl &quot;tasklist&quot; viel mehr erreichen</p>
<pre><code>Description:
    This command line tool displays a list of application(s) and
    associated task(s)/process(es) currently running on either a local or
    remote system.

Parameter List:
   /S     system           Specifies the remote system to connect to.

   /U     [domain\]user    Specifies the user context under which
                           the command should execute.

   /P     [password]       Specifies the password for the given
                           user context. Prompts for input if omitted.

   /M     [module]         Lists all tasks that have DLL modules loaded
                           in them that match the given pattern name.
                           If the module name is not specified,
                           displays all modules loaded by each task.

   /SVC                    Displays services in each process.

   /V                      Specifies that the verbose information
                           is to be displayed.

   /FI    filter           Displays a set of tasks that match a
                           given criteria specified by the filter.

   /FO    format           Specifies the output format.
                           Valid values: &quot;TABLE&quot;, &quot;LIST&quot;, &quot;CSV&quot;.

   /NH                     Specifies that the &quot;Column Header&quot; should
                           not be displayed in the output.
                           Valid only for &quot;TABLE&quot; and &quot;CSV&quot; formats.

   /?                      Displays this help/usage.

Filters:
    Filter Name     Valid Operators           Valid Value(s)
    -----------     ---------------           --------------
    STATUS          eq, ne                    RUNNING | NOT RESPONDING
    IMAGENAME       eq, ne                    Image name
    PID             eq, ne, gt, lt, ge, le    PID value
    SESSION         eq, ne, gt, lt, ge, le    Session number
    SESSIONNAME     eq, ne                    Session name
    CPUTIME         eq, ne, gt, lt, ge, le    CPU time in the format
                                              of hh:mm:ss.
                                              hh - hours,
                                              mm - minutes, ss - seconds
    MEMUSAGE        eq, ne, gt, lt, ge, le    Memory usage in KB
    USERNAME        eq, ne                    User name in [domain\]user
                                              format
    SERVICES        eq, ne                    Service name
    WINDOWTITLE     eq, ne                    Window title
    MODULES         eq, ne                    DLL name

Examples:
    TASKLIST
    TASKLIST /M
    TASKLIST /V
    TASKLIST /SVC
    TASKLIST /M wbem*
    TASKLIST /S system /FO LIST
    TASKLIST /S system /U domain\username /FO CSV /NH
    TASKLIST /S system /U username /P password /FO TABLE /NH
    TASKLIST /FI &quot;USERNAME ne NT AUTHORITY\SYSTEM&quot; /FI &quot;STATUS eq running&quot;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1403124</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403124</guid><dc:creator><![CDATA[dawa85]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:38:58 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:41:24 GMT]]></title><description><![CDATA[<p>dawa85 schrieb:</p>
<blockquote>
<p>wenn du ein CMD Fenster aufmachst, kannst du mit dem Befehl &quot;tasklist&quot; viel mehr erreichen</p>
</blockquote>
<p>... Und was ist, wenn er die Datein weiterverarbeiten möchte?<br />
Da ist etwas natives doch mit Sicherheit besser als irgendein Systemaufruf.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/17065">@Vermillion</a>:<br />
Fehlermeldungen wären hilfreich <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403127</guid><dc:creator><![CDATA[The-Kenny]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:41:24 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:54:30 GMT]]></title><description><![CDATA[<p>Das mit Tasklist ist eine gute Idee allerdings sollten die ausgeführten Programme gezielt beendet werden können und dann später auch in einer SQL oder ODBC Datenbank eingelesen und ausgewertet werden.</p>
<p>EDIT:<br />
Hier der Screent</p>
<p><a href="http://s3.directupload.net/file/d/1246/73yckygm_jpg.htm" rel="nofollow"></a><a href="http://s3.directupload.net/images/071114/temp/73yckygm.jpg" rel="nofollow">http://s3.directupload.net/images/071114/temp/73yckygm.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403131</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:55:24 GMT]]></title><description><![CDATA[<p>der Code ist vollkommen richtig.</p>
<p>Der Compiler findet die iostream.h nicht.<br />
Dadurch werden alle angezeigten Fehler verursacht</p>
<p>Probier mal die Datei in dateiname.cpp umzubennen und erneut zu kompilieren dann könnte es gehn <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403142</guid><dc:creator><![CDATA[dawa85]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:55:24 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 14:56:41 GMT]]></title><description><![CDATA[<p>dawa85 schrieb:</p>
<blockquote>
<p>der Code ist vollkommen richtig.</p>
<p>Dir fehlt die iostream.h<br />
Dadurch werden alle angezeigten Fehler verursacht</p>
</blockquote>
<p>Sein Code ist eventuell richtig; aber iostream.h ist definitiv falsch.<br />
Im aktuellen Standard heißt es &lt;iostream&gt; und nicht &lt;iostream.h&gt;.</p>
<p>Ich denke eher, dass es an der Dateiendung liegt.<br />
.c interpretieren manche Compiler als C-Code, wo es kein iostream etc. gab.</p>
<p>Ändere bitte mal die Endung in .cpp und versuche es noch einmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403143</guid><dc:creator><![CDATA[The-Kenny]]></dc:creator><pubDate>Wed, 14 Nov 2007 14:56:41 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:04:03 GMT]]></title><description><![CDATA[<p>Und wie mach ich die? C++ ist nicht umbedingt meien stärke aber wenn ich bei isostream das .h hinzufüge verschwinden einige aber nicht alle Errormeldungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403145</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:04:03 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:00:13 GMT]]></title><description><![CDATA[<p>Vermillion schrieb:</p>
<blockquote>
<p>Und wie mach ich die? C++ ist nicht umbedingt meien stärke aber wenn ich bei isostream das .h hinzufüge verschwinden einige aber nicht alle Errormeldungen.</p>
</blockquote>
<p>nein &lt;iostream&gt; so lassen das ist richtig.<br />
Nur die Dateiendung der Datei die du kompilierst von .c nach .cpp ändern dann findet der Copmiler die iostream.h</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403147</guid><dc:creator><![CDATA[dawa85]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:00:13 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:04:36 GMT]]></title><description><![CDATA[<p>Die Datei ist eine .dep Datei. Aber dann liegts evtl. daran das ich nen &quot;falschen&quot; Compiler verwende? nehme lcc.</p>
<p>hier ein Screen:<br />
<a href="http://s2.directupload.net/file/d/1246/z478j7jh_jpg.htm" rel="nofollow"></a><a href="http://s2.directupload.net/images/071114/temp/z478j7jh.jpg" rel="nofollow">http://s2.directupload.net/images/071114/temp/z478j7jh.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403150</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:04:36 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:04:00 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/17065">@Vermillion</a><br />
Zeige deine Fehlermeldungen. Sollen wir denn hier raten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403151</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:05:30 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/17065">@Vermillion</a><br />
Zeige deine Fehlermeldungen. Sollen wir denn hier raten?</p>
</blockquote>
<p>In meinem zweiten Post sind die Fehlermeldungen und in dem Post über dir das Verzeichnis mit den Dateien o.O</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403152</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:05:30 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Wed, 14 Nov 2007 15:10:04 GMT]]></title><description><![CDATA[<p>in der Datei mit den Fehlermeldungen steht was von einer:<br />
c:\testprocesss.c in der obersten Zeile. Daraus machst du:<br />
c:\testprocesss.cpp</p>
<p>wenn es dann immer noch nicht geht dann probier in deiner LCC Entwicklungsumgebung ein C++ Projekt anzulegen. Kein C Projekt. Aber viel dazu sagen kann ich nich, da ich die Software nicht kenne</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403157</guid><dc:creator><![CDATA[dawa85]]></dc:creator><pubDate>Wed, 14 Nov 2007 15:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlerhafter Script um Prozesse anzuzeigen on Thu, 15 Nov 2007 11:13:09 GMT]]></title><description><![CDATA[<p>Was benutzt du denn? Eventuell wäre es auch einfacher für mich einfach den Compiler zu wechseln.</p>
<p>Habs jetzt nochmal versucht mit dem umbennen dann kommt aber nur das raus:<br />
<a href="http://s3.directupload.net/file/d/1247/6xpsq89p_jpg.htm" rel="nofollow"></a><a href="http://s3.directupload.net/images/071115/temp/6xpsq89p.jpg" rel="nofollow">http://s3.directupload.net/images/071115/temp/6xpsq89p.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403506</guid><dc:creator><![CDATA[Vermillion]]></dc:creator><pubDate>Thu, 15 Nov 2007 11:13:09 GMT</pubDate></item></channel></rss>