<?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[GUi für Komandozeilen Prog]]></title><description><![CDATA[<p>Ich habe einen Komandozeilen Programm was etwas so lauft:</p>
<p>listuser.exe -all</p>
<p>und die ausgabe ist:</p>
<p>Username ID<br />
User1 6<br />
User4 6<br />
User5 6<br />
User6 6</p>
<p>----------------------</p>
<p>So umm das jetzt auszuwerten (was nich meine problem sein würd). Muss ich erstmal diese Zeilen zeilenweise bekommen. habe ihr ne Idee wie ich die ausgabe bekommen kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/65551/gui-für-komandozeilen-prog</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 15:42:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/65551.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Feb 2004 19:08:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Thu, 19 Feb 2004 19:08:26 GMT]]></title><description><![CDATA[<p>Ich habe einen Komandozeilen Programm was etwas so lauft:</p>
<p>listuser.exe -all</p>
<p>und die ausgabe ist:</p>
<p>Username ID<br />
User1 6<br />
User4 6<br />
User5 6<br />
User6 6</p>
<p>----------------------</p>
<p>So umm das jetzt auszuwerten (was nich meine problem sein würd). Muss ich erstmal diese Zeilen zeilenweise bekommen. habe ihr ne Idee wie ich die ausgabe bekommen kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/463501</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/463501</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Thu, 19 Feb 2004 19:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 07:22:50 GMT]]></title><description><![CDATA[<p>Leite es doch per DOS Befehl in eine Textdatei um un lies die aus.</p>
<p>listuser.exe -all &gt; ergebnis.txt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/463773</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/463773</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Fri, 20 Feb 2004 07:22:50 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 09:40:51 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<pre><code class="language-cpp">char   lineBuffer[128];
   FILE   *flist;

   // statt listuser.exe eventuell vollständigen Pfad, je nachdem
   if( (flist = _popen( &quot;listuser.exe -all&quot;, &quot;rt&quot; )) == NULL )
      AfxMessageBox(&quot;Fehler beim Ausführen von listuser.exe&quot;);
   else
   {
      while( !feof( flist) )
     {
        if( fgets( lineBuffer, 128, flist) != NULL )
           AfxMessageBox(lineBuffer);
     }
   }
</code></pre>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/463882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/463882</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Fri, 20 Feb 2004 09:40:51 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 17:18:49 GMT]]></title><description><![CDATA[<p>Habe das ,al so getest:</p>
<pre><code>char   lineBuffer[128];
   FILE   *flist;

   // statt listuser.exe eventuell vollständigen Pfad, je nachdem
   if( (flist = _popen( &quot;C:\\listuser.exe -all&quot;, &quot;rt&quot; )) == NULL )
      AfxMessageBox(&quot;Fehler beim Ausführen von listuser.exe&quot;);
   else
   {
      while( !feof( flist) )
     {
        if( fgets( lineBuffer, 128, flist) != NULL )
           AfxMessageBox(lineBuffer);
     }
   }
</code></pre>
<p>aber er meldet immer den Fehler. Obwohl die datei 100% da ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464228</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Fri, 20 Feb 2004 17:18:49 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 22:11:33 GMT]]></title><description><![CDATA[<p>Ich habe das mal so versucht:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;conio.h&gt;

void main()
{
     char *cmd = &quot;C:\\listuser.exe -all&quot;;
     char buf[BUFSIZ];
     FILE *ptr;

     if ((ptr = _popen(cmd, &quot;r&quot;)) != NULL)
     {
        while (fgets(buf, BUFSIZ, ptr) != NULL)
        {
              printf(&quot;%s&quot;, buf);
        }
     }

getch();
}
</code></pre>
<p>Das geht ganz super!</p>
<p>Doch schreibe ich in einer MFC anwendung das:</p>
<pre><code class="language-cpp">char *cmd = &quot;C:\\listuser.exe -all&quot;;
     char buf[BUFSIZ];
     FILE *ptr;

     if ((ptr = _popen(cmd, &quot;r&quot;)) != NULL)
     {
        while (fgets(buf, BUFSIZ, ptr) != NULL)
        {
              printf(&quot;%s&quot;, buf);
        }
     }
</code></pre>
<p>lauft nichts es kommt keine Msg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464372</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Fri, 20 Feb 2004 22:11:33 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 22:12:29 GMT]]></title><description><![CDATA[<p>Tauscht bei der MFC ausgabe mal das printf(&quot;%s&quot;, buf);<br />
mit MessageBox(&quot;%s&quot;, buf);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464374</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Fri, 20 Feb 2004 22:12:29 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 22:13:46 GMT]]></title><description><![CDATA[<p>Ah was is los. Sicher so:</p>
<p>MessageBox(buf);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464375</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Fri, 20 Feb 2004 22:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 22:15:29 GMT]]></title><description><![CDATA[<p>Ah was is los. Sicher so:</p>
<p>MessageBox(buf);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464377</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Fri, 20 Feb 2004 22:15:29 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Fri, 20 Feb 2004 22:57:25 GMT]]></title><description><![CDATA[<p>sorry, mein Fehler, es sollte ja eine GUI für dieses Kommandozeilenprogramm werden, _popen funktioniert aber nur in Konsolenprogrammen. Es wird dann deutlich komplizierter, deswegen kann ich hierzu diesen Artikel hier</p>
<p><a href="http://dev-www.codeguru.com/misc/redirect.shtml" rel="nofollow">http://dev-www.codeguru.com/misc/redirect.shtml</a></p>
<p>empfehlen.</p>
<p>Und eine ganze Anwendung, die Kommandozeilenprogramm-Ausgaben in einem GUI darstellt, gibt es hier</p>
<p><a href="http://codeguru.earthweb.com/console/QuickWin.shtml" rel="nofollow">http://codeguru.earthweb.com/console/QuickWin.shtml</a></p>
<p>da kann man die grundsätzliche Technik (Pipes) erkennen.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464390</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Fri, 20 Feb 2004 22:57:25 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Sat, 21 Feb 2004 08:32:28 GMT]]></title><description><![CDATA[<p>Ich habe das mal mit der klasse versucht und twar so:</p>
<p>In der *Dlg.cpp meines Progs habe ich die Redirect.h so eingebunden:</p>
<pre><code class="language-cpp">#include &quot;Redirect.h&quot;
</code></pre>
<p>Und in der *dlg.h meines Progs steht:</p>
<pre><code class="language-cpp">class CRedirect;
</code></pre>
<p>ganz oben. Und etwas weiter unten</p>
<pre><code class="language-cpp">CRedirect *m_pRedirect;
</code></pre>
<p>Dann habe ich auf klick dieses Event ausgelöst:</p>
<pre><code class="language-cpp">CRedirect Redirect(&quot;C:\\Temp\\sample.bat&quot;, m_EditOutput);
Redirect.Run();
</code></pre>
<p>Nur leider bekomme ich folgenden Fehler:</p>
<p>CRedirect::CRedirect(const char *,class CEdit *,const char *)' : Konvertierung des Parameters 2 von 'class CEdit' in 'class CEdit *' nicht moeglich</p>
<p>Ich weis nich was ich falsch mache. Ich habe m_EditOutput als CEdit deklariert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464456</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Sat, 21 Feb 2004 08:32:28 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Sat, 21 Feb 2004 17:53:09 GMT]]></title><description><![CDATA[<p>UP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464782</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Sat, 21 Feb 2004 17:53:09 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Sun, 22 Feb 2004 00:10:40 GMT]]></title><description><![CDATA[<p>du mußt nur die Adresse des CEdit-Objekts übergeben, dann ist der Compiler-Fehler weg:</p>
<pre><code class="language-cpp">CRedirect Redirect(&quot;C:\\Temp\\sample.bat&quot;, &amp;m_EditOutput);
</code></pre>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/464984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/464984</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Sun, 22 Feb 2004 00:10:40 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Sun, 22 Feb 2004 08:05:22 GMT]]></title><description><![CDATA[<p>Das hatte ich auch mal versucht. Da es auch so in der Demo stand die man saugen konnte. Aber dann bekomme ich diese Fehler:</p>
<blockquote>
<p>error LNK2001: Nichtaufgeloestes externes Symbol &quot;public: virtual __thiscall CRedirect::~CRedirect(void)&quot; (??1CRedirect@@UAE@XZ)</p>
<p>error LNK2001: Nichtaufgeloestes externes Symbol &quot;public: virtual void __thiscall CRedirect::Run(void)&quot; (?Run@CRedirect@@UAEXXZ)</p>
<p>error LNK2001: Nichtaufgeloestes externes Symbol &quot;public: __thiscall CRedirect::CRedirect(char const *,class CEdit *,char const *)&quot; (??0CRedirect@@QAE@PBDPAVCEdit@@0@Z)</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/465015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/465015</guid><dc:creator><![CDATA[Mystic]]></dc:creator><pubDate>Sun, 22 Feb 2004 08:05:22 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Sun, 22 Feb 2004 12:46:30 GMT]]></title><description><![CDATA[<p>du hast doch hoffentlich die Datei &quot;Redirect.cpp&quot; mit in die .cpp-Dateien deines Projekts aufgenommen, oder? (es sieht aber so aus, als ob du nur die &quot;redirect.h&quot; hinzugefügt hast)</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/465179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/465179</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Sun, 22 Feb 2004 12:46:30 GMT</pubDate></item><item><title><![CDATA[Reply to GUi für Komandozeilen Prog on Mon, 23 Feb 2004 14:54:08 GMT]]></title><description><![CDATA[<p>Hi !</p>
<p>So kannst Du Dir die Ausgabe eines Konsolenprogramms in Deine GUI-Anwendung anzeigen lassen:</p>
<pre><code class="language-cpp">#define BUFFSIZE 4096 
char cPipeResult[BUFFSIZE];
memset(cPipeResult,0,BUFFSIZE); 
DWORD dwBytes =0; 
PROCESS_INFORMATION PROCCINFO;
LPSECURITY_ATTRIBUTES lpPipeAttributes = NULL;
HANDLE hReadPipe;
HANDLE hWritePipe;
SECURITY_ATTRIBUTES SecAttribs;
SecAttribs.lpSecurityDescriptor = NULL;
SecAttribs.bInheritHandle = TRUE;
SecAttribs.nLength = sizeof(SecAttribs);
if( ! CreatePipe( &amp;hReadPipe,  &amp;hWritePipe,  &amp;SecAttribs, 0))
{
	AfxMessageBox(&quot;Konnte Pipe nicht erstellen&quot;);
}
else // Ok  Prozess vorbereiten
{
	STARTUPINFO INFO;
	INFO.cb=sizeof(STARTUPINFO);
	INFO.lpReserved=NULL;
	INFO.lpDesktop= NULL;
	INFO.lpTitle=NULL;
	INFO.dwX=0;
	INFO.dwY=0;
	INFO.dwXSize=100;
	INFO.dwYSize=100;
	INFO.dwXCountChars=0;
	INFO.dwYCountChars=0;
	INFO.dwFillAttribute=NULL;
	INFO.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW|STARTF_USEPOSITION;
	INFO.wShowWindow= SW_SHOWDEFAULT;
	INFO.cbReserved2=0;
	INFO.lpReserved2=NULL;
	INFO.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
	INFO.hStdOutput= hWritePipe;
	INFO.hStdError= GetStdHandle(STD_ERROR_HANDLE);

	CreateProcess( &quot;C:\\A\\Debug\\A.exe&quot;,NULL, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE|
	    		  NORMAL_PRIORITY_CLASS, NULL, NULL, &amp;INFO, &amp;PROCCINFO); 
    WaitForSingleObject(PROCCINFO.hProcess, 5000);
    ReadFile(hReadPipe, cPipeResult, sizeof(cPipeResult), &amp;dwBytes,NULL);
    AfxMessageBox(cPipeResult);
}
}
</code></pre>
<p>// cPipeResult liefert die Ausgabe der Konsolenanwendung, kann z.B. in eine<br />
// CString Variable eingelesen werden.<br />
// C:\\A\\Debug\\A.exe ist meine Testdatei, das ist der Pfad zur<br />
Konsolenanwendung.<br />
// Möchte man die Ausgabe der Konsolenfensters vermeiden, kann man den Fenster-<br />
// stil SW_SHOWDEFAULT durch SW_HIDE ersetzen<br />
Gruß, J.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/465985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/465985</guid><dc:creator><![CDATA[J^o^e]]></dc:creator><pubDate>Mon, 23 Feb 2004 14:54:08 GMT</pubDate></item></channel></rss>