<?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[Neuer Prozess, wird nicht in neuem Fenster angezeigt...]]></title><description><![CDATA[<p>Hi,<br />
der sender soll einen neuen Prozess starten (den empfänger) und für diesen Prozess ein neues Fenster öffnen in dem dann die Ausgabe durch die Pipe geschieht. Zu funktionieren scheint es nur ein neues Fenster wird leider nicht geöffnet.</p>
<p><strong>sender.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt;

using namespace std;

int main(void){

	// Anlegen aller Variablen etc.
	LPTSTR lpszPipename = TEXT(&quot;\\\\.\\pipe\\huhu&quot;);
	LPTSTR lpvMessage=TEXT(&quot;Es funktioniert!!!&quot;);
	DWORD bytes;
	bool fConnected, create_process; 
	STARTUPINFO si;
    PROCESS_INFORMATION pi;

	// --- Speicher loeschen STARTUPINFO ---
	ZeroMemory( &amp;si, sizeof(si) );
	si.cb = sizeof(si); // Groesse
	si.dwFlags = STARTF_USESHOWWINDOW; // Fensteroptionen
	si.wShowWindow = SW_SHOW; // Neues Fenster soll gezeigt werden, wird aber nicht ?!?!?!

	// --- Speicher loeschen ProcessInfo ---
	ZeroMemory( &amp;pi, sizeof(pi) );

	// Pipe erzeugen
	HANDLE hPipe = CreateNamedPipe( 
          lpszPipename,             // pipe name 
		  PIPE_ACCESS_OUTBOUND,
		  PIPE_WAIT, 
          1,					// max. instances  
          5000,                  // output buffer size 
          5000,                  // input buffer size 
          NMPWAIT_USE_DEFAULT_WAIT, // client time-out 
          NULL);                    // default security attribute 

	if (hPipe != INVALID_HANDLE_VALUE){

		// Überprüfung ob bis hier alles geklapt hat!
		cout &lt;&lt; &quot;Prozess kann gestartet werden, weiter mit eingabe&quot;;
		_getch();

		// Process erzeugen
		create_process = CreateProcess( NULL,   // No module name (use command line). 
        TEXT(&quot;empfaenger.exe&quot;), // Command line. 
        NULL,             // Process handle not inheritable. 
        NULL,             // Thread handle not inheritable. 
        FALSE,            // Set handle inheritance to FALSE. 
        0,                // No creation flags. 
        NULL,             // Use parent's environment block. 
        NULL,             // Use parent's starting directory. 
        &amp;si,              // Pointer to STARTUPINFO structure.
        &amp;pi );             // Pointer to PROCESS_INFORMATION structure.
	}

	// Ist etwas mit der pipe verbunden?
	fConnected = ConnectNamedPipe(hPipe, NULL);

	// Wenn ja dan schreibe in die Pipe
	if(fConnected){
		while(true){
			WriteFile(
			  hPipe,
			  lpvMessage,
			  5000,
			  &amp;bytes,
			  NULL
			  );
		}
	}

	// Alles beenden
	CloseHandle(hPipe); 
	CloseHandle( pi.hProcess );
	CloseHandle( pi.hThread );
	return 0;
}
</code></pre>
<p><strong>empfänger.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt;

using namespace std;

int main(void){

	// Variablen anlegen etc.
	LPTSTR lpszPipename = TEXT(&quot;\\\\.\\pipe\\huhu&quot;);
	bool pipe_wait = false;
	DWORD bytes;
	char ausgabe_buffer[5000];

	// Schleife um zu warten bis die Pipe bereit ist, 
	// nötig da NMPWAIT_WAIT_FOREVER nicht immer funktioniert
	while(true){
		pipe_wait = WaitNamedPipe(
		&quot;\\\\.\\pipe\\huhu&quot;,
		NMPWAIT_WAIT_FOREVER
		);

			// Wenn die Pipe bereit raus aus der Schleife
			if (pipe_wait != 0){
			break;
			}

		// das ganze etwas verlangsamen auf 50ms
		Sleep(50);
	}
	// Überprüfung ob Pipe bereit ist
	cout &lt;&lt; &quot;Pipe gefunden&quot; &lt;&lt; endl;

	// File zur Pipe erzeugen
	HANDLE create_file = CreateFile(
	  &quot;\\\\.\\pipe\\huhu&quot;,
	  GENERIC_READ,
	  0,
	  NULL,
	  OPEN_EXISTING,
	  0,
	  NULL
	);

	while(true){
		// In der schleife aus dem File/Pipe lesen...
		ReadFile(
		  create_file,
		  ausgabe_buffer,
		  5000,
		  &amp;bytes,
		  NULL
		  );

	// und ausgeben
		cout &lt;&lt; ausgabe_buffer;
		system(&quot;Pause&quot;);
	}

CloseHandle(create_file);
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/184622/neuer-prozess-wird-nicht-in-neuem-fenster-angezeigt</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 18:08:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184622.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Jun 2007 14:24:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Neuer Prozess, wird nicht in neuem Fenster angezeigt... on Sun, 17 Jun 2007 14:24:31 GMT]]></title><description><![CDATA[<p>Hi,<br />
der sender soll einen neuen Prozess starten (den empfänger) und für diesen Prozess ein neues Fenster öffnen in dem dann die Ausgabe durch die Pipe geschieht. Zu funktionieren scheint es nur ein neues Fenster wird leider nicht geöffnet.</p>
<p><strong>sender.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt;

using namespace std;

int main(void){

	// Anlegen aller Variablen etc.
	LPTSTR lpszPipename = TEXT(&quot;\\\\.\\pipe\\huhu&quot;);
	LPTSTR lpvMessage=TEXT(&quot;Es funktioniert!!!&quot;);
	DWORD bytes;
	bool fConnected, create_process; 
	STARTUPINFO si;
    PROCESS_INFORMATION pi;

	// --- Speicher loeschen STARTUPINFO ---
	ZeroMemory( &amp;si, sizeof(si) );
	si.cb = sizeof(si); // Groesse
	si.dwFlags = STARTF_USESHOWWINDOW; // Fensteroptionen
	si.wShowWindow = SW_SHOW; // Neues Fenster soll gezeigt werden, wird aber nicht ?!?!?!

	// --- Speicher loeschen ProcessInfo ---
	ZeroMemory( &amp;pi, sizeof(pi) );

	// Pipe erzeugen
	HANDLE hPipe = CreateNamedPipe( 
          lpszPipename,             // pipe name 
		  PIPE_ACCESS_OUTBOUND,
		  PIPE_WAIT, 
          1,					// max. instances  
          5000,                  // output buffer size 
          5000,                  // input buffer size 
          NMPWAIT_USE_DEFAULT_WAIT, // client time-out 
          NULL);                    // default security attribute 

	if (hPipe != INVALID_HANDLE_VALUE){

		// Überprüfung ob bis hier alles geklapt hat!
		cout &lt;&lt; &quot;Prozess kann gestartet werden, weiter mit eingabe&quot;;
		_getch();

		// Process erzeugen
		create_process = CreateProcess( NULL,   // No module name (use command line). 
        TEXT(&quot;empfaenger.exe&quot;), // Command line. 
        NULL,             // Process handle not inheritable. 
        NULL,             // Thread handle not inheritable. 
        FALSE,            // Set handle inheritance to FALSE. 
        0,                // No creation flags. 
        NULL,             // Use parent's environment block. 
        NULL,             // Use parent's starting directory. 
        &amp;si,              // Pointer to STARTUPINFO structure.
        &amp;pi );             // Pointer to PROCESS_INFORMATION structure.
	}

	// Ist etwas mit der pipe verbunden?
	fConnected = ConnectNamedPipe(hPipe, NULL);

	// Wenn ja dan schreibe in die Pipe
	if(fConnected){
		while(true){
			WriteFile(
			  hPipe,
			  lpvMessage,
			  5000,
			  &amp;bytes,
			  NULL
			  );
		}
	}

	// Alles beenden
	CloseHandle(hPipe); 
	CloseHandle( pi.hProcess );
	CloseHandle( pi.hThread );
	return 0;
}
</code></pre>
<p><strong>empfänger.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt;

using namespace std;

int main(void){

	// Variablen anlegen etc.
	LPTSTR lpszPipename = TEXT(&quot;\\\\.\\pipe\\huhu&quot;);
	bool pipe_wait = false;
	DWORD bytes;
	char ausgabe_buffer[5000];

	// Schleife um zu warten bis die Pipe bereit ist, 
	// nötig da NMPWAIT_WAIT_FOREVER nicht immer funktioniert
	while(true){
		pipe_wait = WaitNamedPipe(
		&quot;\\\\.\\pipe\\huhu&quot;,
		NMPWAIT_WAIT_FOREVER
		);

			// Wenn die Pipe bereit raus aus der Schleife
			if (pipe_wait != 0){
			break;
			}

		// das ganze etwas verlangsamen auf 50ms
		Sleep(50);
	}
	// Überprüfung ob Pipe bereit ist
	cout &lt;&lt; &quot;Pipe gefunden&quot; &lt;&lt; endl;

	// File zur Pipe erzeugen
	HANDLE create_file = CreateFile(
	  &quot;\\\\.\\pipe\\huhu&quot;,
	  GENERIC_READ,
	  0,
	  NULL,
	  OPEN_EXISTING,
	  0,
	  NULL
	);

	while(true){
		// In der schleife aus dem File/Pipe lesen...
		ReadFile(
		  create_file,
		  ausgabe_buffer,
		  5000,
		  &amp;bytes,
		  NULL
		  );

	// und ausgeben
		cout &lt;&lt; ausgabe_buffer;
		system(&quot;Pause&quot;);
	}

CloseHandle(create_file);
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1307724</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307724</guid><dc:creator><![CDATA[Laines]]></dc:creator><pubDate>Sun, 17 Jun 2007 14:24:31 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Prozess, wird nicht in neuem Fenster angezeigt... on Sun, 17 Jun 2007 14:27:59 GMT]]></title><description><![CDATA[<p>Was ich noch vergessen habe, wie kann ich das ganze statt mit einem String, mit einer Struktur machen.</p>
<p>Was ich habe will ist, das sender, zahlen erzeugt. Empfänger liest sie und gibt sie aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307730</guid><dc:creator><![CDATA[Laines]]></dc:creator><pubDate>Sun, 17 Jun 2007 14:27:59 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Prozess, wird nicht in neuem Fenster angezeigt... on Tue, 19 Jun 2007 14:45:12 GMT]]></title><description><![CDATA[<p>Laines schrieb:</p>
<blockquote>
<p>Was ich noch vergessen habe, wie kann ich das ganze statt mit einem String, mit einer Struktur machen.</p>
<p>Was ich habe will ist, das sender, zahlen erzeugt. Empfänger liest sie und gibt sie aus.</p>
</blockquote>
<p>Kann mir keiner Helfen <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>Besonders obiges Problem macht mir zu schaffen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309212</guid><dc:creator><![CDATA[Laines]]></dc:creator><pubDate>Tue, 19 Jun 2007 14:45:12 GMT</pubDate></item></channel></rss>