<?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[CreateProcess Problem]]></title><description><![CDATA[<p>hi leute! gleich etwas code:</p>
<pre><code class="language-cpp">class MyProcess
{
public:
	MyProcess(string Application_Name)
	{
		PROCESS_INFORMATION pi = {0}; 
		STARTUPINFO si = {sizeof(si)}; 
		si.wShowWindow = SW_NORMAL; 

		if(CreateProcess(NULL,reinterpret_cast&lt;const char*&gt;(Application_Name.c_str()),NULL,NULL,false,CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,NULL,&quot;c:\\&quot;,&amp;si,&amp;pi)==false)
			throw ProcessException(&quot;::CreateProcess failed&quot;, __FILE__, __LINE__);
	}
};
</code></pre>
<p>error:</p>
<pre><code class="language-cpp">error C2664: 'CreateProcessA' : cannot convert parameter 2 from 'const char *' to 'LPSTR'
</code></pre>
<p>der cast funktioniert nicht;-( ich weiß nicht wie ich das ändern soll...</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/92667/createprocess-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 21:02:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/92667.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Nov 2004 01:45:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 01:45:39 GMT]]></title><description><![CDATA[<p>hi leute! gleich etwas code:</p>
<pre><code class="language-cpp">class MyProcess
{
public:
	MyProcess(string Application_Name)
	{
		PROCESS_INFORMATION pi = {0}; 
		STARTUPINFO si = {sizeof(si)}; 
		si.wShowWindow = SW_NORMAL; 

		if(CreateProcess(NULL,reinterpret_cast&lt;const char*&gt;(Application_Name.c_str()),NULL,NULL,false,CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,NULL,&quot;c:\\&quot;,&amp;si,&amp;pi)==false)
			throw ProcessException(&quot;::CreateProcess failed&quot;, __FILE__, __LINE__);
	}
};
</code></pre>
<p>error:</p>
<pre><code class="language-cpp">error C2664: 'CreateProcessA' : cannot convert parameter 2 from 'const char *' to 'LPSTR'
</code></pre>
<p>der cast funktioniert nicht;-( ich weiß nicht wie ich das ändern soll...</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/656414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656414</guid><dc:creator><![CDATA[nike.]]></dc:creator><pubDate>Mon, 22 Nov 2004 01:45:39 GMT</pubDate></item><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 05:29:22 GMT]]></title><description><![CDATA[<p>CreateProcess ändert unter Umständen den Inhalt des Strings, den du als zweiten Parameter übergibst. Daher darf der kein Zeiger auf <em>const</em> char sein.</p>
<p>Du musst den Inhalt des Strings in ein hinreichend großes char-Array kopieren und dann das übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/656420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656420</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 22 Nov 2004 05:29:22 GMT</pubDate></item><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 07:16:27 GMT]]></title><description><![CDATA[<p>nike. schrieb:</p>
<blockquote>
<p>der cast funktioniert nicht;-(</p>
</blockquote>
<p>Das liegt daran, dass das der falsche Cast ist. Mit const_cast geht sowas.<br />
Das wäre aber trotzdem die falsche Vorgehensweise. Machs einfach so wie's MFK vorgeschlagen hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/656436</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656436</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Mon, 22 Nov 2004 07:16:27 GMT</pubDate></item><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 11:01:42 GMT]]></title><description><![CDATA[<p>habs so geändert:</p>
<pre><code class="language-cpp">class MyProcess
{
public:
	MyProcess()
	{
		ZeroMemory( &amp;si, sizeof(si) );
        si.cb = sizeof(si);
        ZeroMemory( &amp;pi, sizeof(pi) );
		si.wShowWindow = SW_NORMAL;
	}

	void StartProcess(std::string ApplicationName)
	{
			if(CreateProcess(NULL,const_cast&lt;char*&gt;(ApplicationName.c_str()),NULL,NULL,false,CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,NULL,&quot;c:\\&quot;,&amp;si,&amp;pi)==false)
				throw ProcessException(&quot;::CreateProcess failed&quot;, __FILE__, __LINE__);
	}

private:
	PROCESS_INFORMATION pi;
	STARTUPINFO si;
};
</code></pre>
<p>frage welchen errorcode außer false lieftert CreatProcess noch?</p>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/656495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656495</guid><dc:creator><![CDATA[nike.]]></dc:creator><pubDate>Mon, 22 Nov 2004 11:01:42 GMT</pubDate></item><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 11:03:54 GMT]]></title><description><![CDATA[<p>aus der msdn<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp</a></p>
<pre><code>If the function fails, the return value is zero. To get extended error information, call GetLastError.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/656497</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656497</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Mon, 22 Nov 2004 11:03:54 GMT</pubDate></item><item><title><![CDATA[Reply to CreateProcess Problem on Mon, 22 Nov 2004 11:26:38 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1784">@nike</a><br />
Wieso machst du's nicht so, wie's MFK vorgeschlagen hat? c_str() ist nicht ohne Grund const. Im Moment hab ich die Befürchtung, dass dein Programm uU hier UB haben kann.</p>
<p>btw:<br />
Übergib einen String als Referenz. Das spart Ressourcen und Rechenzeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/656510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/656510</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Mon, 22 Nov 2004 11:26:38 GMT</pubDate></item></channel></rss>