<?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[Konsole öffnen]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich versuche ein Programm zu schreiben, vielleicht ist genau da der Fehler ^^</p>
<p>Ne Spass bei Seite ich will eigentlich nur aus einem Fenster heraus die Konsole öffnen und ihr dann mit teilen dass sie meinem Fenster untergeordnet ist.</p>
<p>Aber soweit bin ich ja noch gar nicht, mom versuch ich nur via CreateProces mal die Konsole zu &quot;starten&quot; das allerdings nicht mit Erfolg<br />
Ich poste einfach mal den Code</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;tchar.h&gt;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow)
{
	HWND				hwnd;
	MSG					msg;
	WNDCLASSEX			wndclassex;
	STARTUPINFO			si;
	PROCESS_INFORMATION pi;
	SECURITY_ATTRIBUTES secattr;
	HANDLE				rPipe, wPipe;

	ZeroMemory( &amp;si,		sizeof(si)		);
	ZeroMemory( &amp;pi,		sizeof(pi)		);
	ZeroMemory( &amp;secattr,	sizeof(secattr)	);

	static TCHAR szAppName[]	= TEXT (&quot;ConsoleDesktop&quot;);
	LPTSTR szCmdline			= _tcsdup(_T(&quot;Console&quot;));
	secattr.nLength				= sizeof(secattr);
	secattr.bInheritHandle		= TRUE;

	CreatePipe(&amp;rPipe,&amp;wPipe,&amp;secattr,0); 

	si.cb			= sizeof(si);

	wndclassex.cbSize        = sizeof(WNDCLASSEX);
	wndclassex.style         = CS_HREDRAW | CS_VREDRAW;
	wndclassex.lpfnWndProc   = WndProc;
	wndclassex.cbClsExtra    = 0;
	wndclassex.cbWndExtra    = 0;
	wndclassex.hInstance     = hInstance;
	wndclassex.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
	wndclassex.hCursor       = LoadCursor (NULL, IDC_ARROW);
	wndclassex.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
	wndclassex.lpszMenuName  = NULL;
	wndclassex.lpszClassName = szAppName;
	wndclassex.hIconSm       = wndclassex.hIcon;

   if (!RegisterClassEx (&amp;wndclassex))
   {
	   MessageBox (NULL, TEXT (&quot;RegisterClassEx fehlgeschlagen!&quot;),
                   szAppName, MB_ICONERROR);
	   return -1;
   }

   hwnd = CreateWindowEx(WS_EX_APPWINDOW,
                  szAppName, 
                  TEXT (&quot;&quot;),
                  WS_VISIBLE | WS_POPUPWINDOW,
                  CW_USEDEFAULT,                  
                  CW_USEDEFAULT,      
                  CW_USEDEFAULT,              
                  CW_USEDEFAULT,              
                  NULL,
                  NULL,          
                  hInstance,     
                  NULL);

	ShowWindow (hwnd, iCmdShow);
	UpdateWindow (hwnd);	
	if( !CreateProcess(	NULL,_T(&quot;cmd&quot;),NULL,NULL,TRUE,
						NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
						NULL,NULL,&amp;si,&amp;pi)) //HIER BRICHT ALLES ZUSAMMEN UND ICH WEIS NICHT WIESO
		{MessageBox(0,_T(&quot;ohoh&quot;),_T(&quot;ohoh&quot;),0);}

	while (GetMessage (&amp;msg, NULL, 0, 0))
	{
		TranslateMessage (&amp;msg);
		DispatchMessage (&amp;msg);
	}
	return msg.wParam;
}

// Die Hauptnachrichtenschleife
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	PAINTSTRUCT ps;

	switch (message)
	{
	case WM_DESTROY:
		PostQuitMessage (0);
		return (0);
	}

	return DefWindowProc (hwnd, message, wParam, lParam);
}
</code></pre>
<p>Die Fehlermeldung die ich beim starten bekomme lautet:</p>
<p>Unbehandelte Ausnahme bei 0x7c82f293 in api.exe: 0xC0000005: Zugriffsverletzung beim Schreiben an Position 0x0041599a.</p>
<p>also es muss an der STARTUPINFO oder PROCESS_INFORMATION liegen aber ich komm nicht dahinter<br />
need help</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/159976/konsole-öffnen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Jul 2026 06:04:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159976.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Sep 2006 15:04:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Konsole öffnen on Wed, 20 Sep 2006 15:09:35 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich versuche ein Programm zu schreiben, vielleicht ist genau da der Fehler ^^</p>
<p>Ne Spass bei Seite ich will eigentlich nur aus einem Fenster heraus die Konsole öffnen und ihr dann mit teilen dass sie meinem Fenster untergeordnet ist.</p>
<p>Aber soweit bin ich ja noch gar nicht, mom versuch ich nur via CreateProces mal die Konsole zu &quot;starten&quot; das allerdings nicht mit Erfolg<br />
Ich poste einfach mal den Code</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;tchar.h&gt;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow)
{
	HWND				hwnd;
	MSG					msg;
	WNDCLASSEX			wndclassex;
	STARTUPINFO			si;
	PROCESS_INFORMATION pi;
	SECURITY_ATTRIBUTES secattr;
	HANDLE				rPipe, wPipe;

	ZeroMemory( &amp;si,		sizeof(si)		);
	ZeroMemory( &amp;pi,		sizeof(pi)		);
	ZeroMemory( &amp;secattr,	sizeof(secattr)	);

	static TCHAR szAppName[]	= TEXT (&quot;ConsoleDesktop&quot;);
	LPTSTR szCmdline			= _tcsdup(_T(&quot;Console&quot;));
	secattr.nLength				= sizeof(secattr);
	secattr.bInheritHandle		= TRUE;

	CreatePipe(&amp;rPipe,&amp;wPipe,&amp;secattr,0); 

	si.cb			= sizeof(si);

	wndclassex.cbSize        = sizeof(WNDCLASSEX);
	wndclassex.style         = CS_HREDRAW | CS_VREDRAW;
	wndclassex.lpfnWndProc   = WndProc;
	wndclassex.cbClsExtra    = 0;
	wndclassex.cbWndExtra    = 0;
	wndclassex.hInstance     = hInstance;
	wndclassex.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
	wndclassex.hCursor       = LoadCursor (NULL, IDC_ARROW);
	wndclassex.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
	wndclassex.lpszMenuName  = NULL;
	wndclassex.lpszClassName = szAppName;
	wndclassex.hIconSm       = wndclassex.hIcon;

   if (!RegisterClassEx (&amp;wndclassex))
   {
	   MessageBox (NULL, TEXT (&quot;RegisterClassEx fehlgeschlagen!&quot;),
                   szAppName, MB_ICONERROR);
	   return -1;
   }

   hwnd = CreateWindowEx(WS_EX_APPWINDOW,
                  szAppName, 
                  TEXT (&quot;&quot;),
                  WS_VISIBLE | WS_POPUPWINDOW,
                  CW_USEDEFAULT,                  
                  CW_USEDEFAULT,      
                  CW_USEDEFAULT,              
                  CW_USEDEFAULT,              
                  NULL,
                  NULL,          
                  hInstance,     
                  NULL);

	ShowWindow (hwnd, iCmdShow);
	UpdateWindow (hwnd);	
	if( !CreateProcess(	NULL,_T(&quot;cmd&quot;),NULL,NULL,TRUE,
						NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
						NULL,NULL,&amp;si,&amp;pi)) //HIER BRICHT ALLES ZUSAMMEN UND ICH WEIS NICHT WIESO
		{MessageBox(0,_T(&quot;ohoh&quot;),_T(&quot;ohoh&quot;),0);}

	while (GetMessage (&amp;msg, NULL, 0, 0))
	{
		TranslateMessage (&amp;msg);
		DispatchMessage (&amp;msg);
	}
	return msg.wParam;
}

// Die Hauptnachrichtenschleife
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	PAINTSTRUCT ps;

	switch (message)
	{
	case WM_DESTROY:
		PostQuitMessage (0);
		return (0);
	}

	return DefWindowProc (hwnd, message, wParam, lParam);
}
</code></pre>
<p>Die Fehlermeldung die ich beim starten bekomme lautet:</p>
<p>Unbehandelte Ausnahme bei 0x7c82f293 in api.exe: 0xC0000005: Zugriffsverletzung beim Schreiben an Position 0x0041599a.</p>
<p>also es muss an der STARTUPINFO oder PROCESS_INFORMATION liegen aber ich komm nicht dahinter<br />
need help</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1141255</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1141255</guid><dc:creator><![CDATA[bigmama]]></dc:creator><pubDate>Wed, 20 Sep 2006 15:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to Konsole öffnen on Wed, 20 Sep 2006 21:58:41 GMT]]></title><description><![CDATA[<p>Definier<br />
STARTUPINFO si und<br />
PROCESS_INFORMATION pi<br />
mal global. Bei mir geht es dann, ansonsten nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1141488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1141488</guid><dc:creator><![CDATA[Mapp]]></dc:creator><pubDate>Wed, 20 Sep 2006 21:58:41 GMT</pubDate></item></channel></rss>