<?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[Läuft ein Programm???]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann man in einem Programm kontrollieren ob ein anderes gerade läuft???</p>
<p>BigTHX</p>
<p>Elmo2k</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/5949/läuft-ein-programm</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 13:22:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/5949.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 May 2003 09:04:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Läuft ein Programm??? on Wed, 28 May 2003 09:04:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann man in einem Programm kontrollieren ob ein anderes gerade läuft???</p>
<p>BigTHX</p>
<p>Elmo2k</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28922</guid><dc:creator><![CDATA[Elmo2k]]></dc:creator><pubDate>Wed, 28 May 2003 09:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to Läuft ein Programm??? on Wed, 28 May 2003 09:40:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;tlhelp32.h&gt;
#include &lt;stdio.h&gt;

BOOL GetProcessList () 
{ 
    HANDLE         hProcessSnap = NULL; 
    BOOL           bRet      = FALSE; 
    PROCESSENTRY32 pe32      = {0}; 

    //  Take a snapshot of all processes in the system. 

    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 

    if (hProcessSnap == INVALID_HANDLE_VALUE) 
        return (FALSE); 

    //  Fill in the size of the structure before using it. 

    pe32.dwSize = sizeof(PROCESSENTRY32); 

    //  Walk the snapshot of the processes, and for each process, 
    //  display information. 

    if (Process32First(hProcessSnap, &amp;pe32)) 
    { 
        DWORD         dwPriorityClass; 
        BOOL          bGotModule = FALSE; 
        MODULEENTRY32 me32       = {0}; 

        do 
        { 
            bGotModule = GetProcessModule(pe32.th32ProcessID, 
                pe32.th32ModuleID, &amp;me32, sizeof(MODULEENTRY32)); 

            if (bGotModule) 
            { 
                HANDLE hProcess; 

                // Get the actual priority class. 
                hProcess = OpenProcess (PROCESS_ALL_ACCESS, 
                    FALSE, pe32.th32ProcessID); 
                dwPriorityClass = GetPriorityClass (hProcess); 
                CloseHandle (hProcess); 

                // Print the process's information. 
                printf( &quot;\nPriority Class Base\t%d\n&quot;, 
                    pe32.pcPriClassBase); 
                printf( &quot;PID\t\t\t%d\n&quot;, pe32.th32ProcessID);
                printf( &quot;Thread Count\t\t%d\n&quot;, pe32.cntThreads);
                printf( &quot;Module Name\t\t%s\n&quot;, me32.szModule);
                printf( &quot;Full Path\t\t%s\n\n&quot;, me32.szExePath);
            } 
        } 
        while (Process32Next(hProcessSnap, &amp;pe32)); 
        bRet = TRUE; 
    } 
    else 
        bRet = FALSE;    // could not walk the list of processes 

    // Do not forget to clean up the snapshot object. 

    CloseHandle (hProcessSnap); 
    return (bRet); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/28923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28923</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Wed, 28 May 2003 09:40:00 GMT</pubDate></item><item><title><![CDATA[Reply to Läuft ein Programm??? on Wed, 28 May 2003 09:54:00 GMT]]></title><description><![CDATA[<p>FindWindow (MSDN)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28924</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28924</guid><dc:creator><![CDATA[%]]></dc:creator><pubDate>Wed, 28 May 2003 09:54:00 GMT</pubDate></item><item><title><![CDATA[Reply to Läuft ein Programm??? on Wed, 28 May 2003 10:12:00 GMT]]></title><description><![CDATA[<p>error C2065: 'GetProcessModule' : nichtdeklarierter Bezeichner</p>
<p>was nun???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28925</guid><dc:creator><![CDATA[Elmo2k]]></dc:creator><pubDate>Wed, 28 May 2003 10:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Läuft ein Programm??? on Wed, 28 May 2003 11:09:00 GMT]]></title><description><![CDATA[<blockquote>
<p>was nun???</p>
</blockquote>
<p>- MSDN aufschlagen<br />
- einen der API-calls eintippen der mit dem Thema was zu tun habe könnte (z.B Process32First).<br />
- mit erstaunen festellen, das auch ein Beispiel dazu drin ist und CMatt geklaut hat<br />
- Copy&amp;Paste bedienen<br />
- Compilerfehler<br />
- Auf schei* MSDN Beispiele schimpfen die nie gehen<br />
- Trozdem nochmal nachsehen..<br />
- Nun auch Text durchlesen (&quot;...For each process, the function calls GetProcessModule, which is defined in Traversing the module list.... &quot;)<br />
- Draufklicken<br />
- Staunend den nächsten code bewundern und zurück zu Punkt 4<br />
:p :p :p :p</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;tlhelp32.h&gt;

BOOL GetProcessModule (DWORD dwPID, DWORD dwModuleID, 
     LPMODULEENTRY32 lpMe32, DWORD cbMe32) 
{ 
    BOOL          bRet        = FALSE; 
    BOOL          bFound      = FALSE; 
    HANDLE        hModuleSnap = NULL; 
    MODULEENTRY32 me32        = {0}; 

    // Take a snapshot of all modules in the specified process. 

    hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPID); 
    if (hModuleSnap == INVALID_HANDLE_VALUE) 
        return (FALSE); 

    // Fill the size of the structure before using it. 

    me32.dwSize = sizeof(MODULEENTRY32); 

    // Walk the module list of the process, and find the module of 
    // interest. Then copy the information to the buffer pointed 
    // to by lpMe32 so that it can be returned to the caller. 

    if (Module32First(hModuleSnap, &amp;me32)) 
    { 
        do 
        { 
            if (me32.th32ModuleID == dwModuleID) 
            { 
                CopyMemory (lpMe32, &amp;me32, cbMe32); 
                bFound = TRUE; 
            } 
        } 
        while (!bFound &amp;&amp; Module32Next(hModuleSnap, &amp;me32)); 

        bRet = bFound;   // if this sets bRet to FALSE, dwModuleID 
                         // no longer exists in specified process 
    } 
    else 
        bRet = FALSE;           // could not walk module list 

    // Do not forget to clean up the snapshot object. 

    CloseHandle (hModuleSnap); 

    return (bRet); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/28926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28926</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Wed, 28 May 2003 11:09:00 GMT</pubDate></item><item><title><![CDATA[Reply to Läuft ein Programm??? on Fri, 30 May 2003 07:15:00 GMT]]></title><description><![CDATA[<p>Jetzt di ganz harte:</p>
<pre><code class="language-cpp">BOOL GetProcessList() 
{ 
    HANDLE         hProcessSnap = NULL; 
    BOOL           bRet      = FALSE; 
    PROCESSENTRY32 pe32      = {0}; 

    //  Take a snapshot of all processes in the system. 

    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 

    if (hProcessSnap == INVALID_HANDLE_VALUE) 
        return (FALSE); 

    //  Fill in the size of the structure before using it. 

    pe32.dwSize = sizeof(PROCESSENTRY32); 

    //  Walk the snapshot of the processes, and for each process, 
    //  display information. 

    if (Process32First(hProcessSnap, &amp;pe32)) 
    { 
        DWORD         dwPriorityClass; 
        BOOL          bGotModule = FALSE; 
        MODULEENTRY32 me32       = {0}; 

        do 
        { 
            bGotModule = GetProcessModule(pe32.th32ProcessID, 
                pe32.th32ModuleID, &amp;me32, sizeof(MODULEENTRY32)); 

            if (bGotModule) 
            { 
                HANDLE hProcess; 

                // Get the actual priority class. 
                hProcess = OpenProcess (PROCESS_ALL_ACCESS, 
                    FALSE, pe32.th32ProcessID); 
                dwPriorityClass = GetPriorityClass (hProcess); 
                CloseHandle (hProcess); 

                // Print the process's information. 
                printf( &quot;\nPriority Class Base\t%d\n&quot;, 
                    pe32.pcPriClassBase); 
                printf( &quot;PID\t\t\t%d\n&quot;, pe32.th32ProcessID);
                printf( &quot;Thread Count\t\t%d\n&quot;, pe32.cntThreads);
                printf( &quot;Module Name\t\t%s\n&quot;, me32.szModule);
                printf( &quot;Full Path\t\t%s\n\n&quot;, me32.szExePath);
            } 
        } 
        while (Process32Next(hProcessSnap, &amp;pe32)); 
        bRet = TRUE; 
    } 
    else 
        bRet = FALSE;    // could not walk the list of processes 

    // Do not forget to clean up the snapshot object. 

    CloseHandle (hProcessSnap); 
    return (bRet); 
} 

BOOL GetProcessModule(DWORD dwPID, DWORD dwModuleID, LPMODULEENTRY32 lpMe32, DWORD cbMe32) 
{ 
    BOOL          bRet        = FALSE; 
    BOOL          bFound      = FALSE; 
    HANDLE        hModuleSnap = NULL; 
    MODULEENTRY32 me32        = {0}; 

    // Take a snapshot of all modules in the specified process. 

    hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPID); 
    if (hModuleSnap == INVALID_HANDLE_VALUE) 
        return (FALSE); 

    // Fill the size of the structure before using it. 

    me32.dwSize = sizeof(MODULEENTRY32); 

    // Walk the module list of the process, and find the module of 
    // interest. Then copy the information to the buffer pointed 
    // to by lpMe32 so that it can be returned to the caller. 

    if (Module32First(hModuleSnap, &amp;me32)) 
    { 
        do 
        { 
            if (me32.th32ModuleID == dwModuleID) 
            { 
                CopyMemory (lpMe32, &amp;me32, cbMe32); 
                bFound = TRUE; 
            } 
        } 
        while (!bFound &amp;&amp; Module32Next(hModuleSnap, &amp;me32)); 

        bRet = bFound;   // if this sets bRet to FALSE, dwModuleID 
                         // no longer exists in specified process 
    } 
    else 
        bRet = FALSE;           // could not walk module list 

    // Do not forget to clean up the snapshot object. 

    CloseHandle (hModuleSnap); 

    return (bRet); 
}
</code></pre>
<p>Warum bekomme ich diese Fehler:</p>
<p>error C2065: 'GetProcessModule' : nichtdeklarierter Bezeichner<br />
error C2373: 'GetProcessModule' : Neudefinition; unterschiedliche Modifizierer</p>
<p>Wenn ich es so aufrufe:</p>
<pre><code class="language-cpp">GetProcessList();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/28927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28927</guid><dc:creator><![CDATA[Dieter]]></dc:creator><pubDate>Fri, 30 May 2003 07:15:00 GMT</pubDate></item></channel></rss>