<?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[datei erneut öffnen-&amp;gt;FEHLER]]></title><description><![CDATA[<p>wenn ich ne datei öffne und dann erneut öffne, dann krieg ich nen fehler!</p>
<p>hier ein auszug ausm code:</p>
<pre><code class="language-cpp">char *LoadFileToObj(char* file, HWND toshow) 
{ 
	HANDLE hf;
	hf = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
	unsigned long nRead = GetFileSize(hf,NULL);
	char *lpbuffer = new char[nRead];
	unsigned long nBytesRead;
	lpbuffer[nRead]=0;
	ReadFile(hf,lpbuffer,nRead,&amp;nBytesRead, NULL);
	SetWindowText(toshow, file);
	return lpbuffer;
}
void SaveToFile(char *pFilename, char *pBuffer, int nSize) 
{
	HANDLE hf;
	hf = CreateFile(pFilename, GENERIC_WRITE, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
	unsigned long nBytesRead;
	WriteFile(hf , pBuffer, nSize, &amp;nBytesRead, NULL);
}
inline int GetEditTextLength(HWND hWnd) 
{ 
  return SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0)+1; 
}
void OpenOrSaveDlg(bool mode, HWND hFileWindow, HWND hContentWindow, HWND hwnd)
{
	if(mode == TRUE) 
	{
		OPENFILENAME ofn;       // common dialog box structure
		char szFile[260];       // buffer for file name&lt;
		// Los Gehts (MSDN krams)
		//Memory leeren:
		ZeroMemory(&amp;ofn, sizeof(ofn));
		//Grösse, Owner, File...
		ofn.lStructSize = sizeof(ofn);
		ofn.hwndOwner = hwnd;
		ofn.lpstrFile = szFile;
		//
		// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
		// use the contents of szFile to initialize itself.
		//
		//Anm,: ???
		ofn.lpstrFile[0] = '\0';
		ofn.nMaxFile = sizeof(szFile);
		ofn.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
		ofn.nFilterIndex = 1;
		ofn.lpstrFileTitle = NULL;
		ofn.nMaxFileTitle = 0;
		ofn.lpstrInitialDir = NULL;
		ofn.Flags = OFN_OVERWRITEPROMPT;
		if (GetSaveFileName(&amp;ofn)==TRUE) 
		{
			char *lpBuffer = new char[GetEditTextLength(hContentWindow)];
			GetWindowText(hContentWindow, lpBuffer, GetEditTextLength(hContentWindow));
			SaveToFile(ofn.lpstrFile, lpBuffer, GetEditTextLength(hContentWindow));
		}
	}
	if(mode == FALSE) 
	{
		OPENFILENAME ofn2;
		char szFile[260];      
		ZeroMemory(&amp;ofn2, sizeof(ofn2));
		ofn2.lStructSize = sizeof(ofn2);
		ofn2.hwndOwner = hwnd;
		ofn2.lpstrFile = szFile;
		ofn2.lpstrFile[0] = '\0';
		ofn2.nMaxFile = sizeof(szFile);
		ofn2.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
		ofn2.nFilterIndex = 1;
		ofn2.lpstrFileTitle = NULL;
		ofn2.nMaxFileTitle = 0;
		ofn2.lpstrInitialDir = NULL;
		ofn2.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
		if (GetOpenFileName(&amp;ofn2)==TRUE) 
		{
			SetWindowText(hContentWindow, LoadFileToObj(ofn2.lpstrFile, hFileWindow));
		}
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/77917/datei-erneut-öffnen-gt-fehler</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 02:00:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/77917.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Jun 2004 17:11:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to datei erneut öffnen-&amp;gt;FEHLER on Fri, 25 Jun 2004 17:11:21 GMT]]></title><description><![CDATA[<p>wenn ich ne datei öffne und dann erneut öffne, dann krieg ich nen fehler!</p>
<p>hier ein auszug ausm code:</p>
<pre><code class="language-cpp">char *LoadFileToObj(char* file, HWND toshow) 
{ 
	HANDLE hf;
	hf = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
	unsigned long nRead = GetFileSize(hf,NULL);
	char *lpbuffer = new char[nRead];
	unsigned long nBytesRead;
	lpbuffer[nRead]=0;
	ReadFile(hf,lpbuffer,nRead,&amp;nBytesRead, NULL);
	SetWindowText(toshow, file);
	return lpbuffer;
}
void SaveToFile(char *pFilename, char *pBuffer, int nSize) 
{
	HANDLE hf;
	hf = CreateFile(pFilename, GENERIC_WRITE, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
	unsigned long nBytesRead;
	WriteFile(hf , pBuffer, nSize, &amp;nBytesRead, NULL);
}
inline int GetEditTextLength(HWND hWnd) 
{ 
  return SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0)+1; 
}
void OpenOrSaveDlg(bool mode, HWND hFileWindow, HWND hContentWindow, HWND hwnd)
{
	if(mode == TRUE) 
	{
		OPENFILENAME ofn;       // common dialog box structure
		char szFile[260];       // buffer for file name&lt;
		// Los Gehts (MSDN krams)
		//Memory leeren:
		ZeroMemory(&amp;ofn, sizeof(ofn));
		//Grösse, Owner, File...
		ofn.lStructSize = sizeof(ofn);
		ofn.hwndOwner = hwnd;
		ofn.lpstrFile = szFile;
		//
		// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
		// use the contents of szFile to initialize itself.
		//
		//Anm,: ???
		ofn.lpstrFile[0] = '\0';
		ofn.nMaxFile = sizeof(szFile);
		ofn.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
		ofn.nFilterIndex = 1;
		ofn.lpstrFileTitle = NULL;
		ofn.nMaxFileTitle = 0;
		ofn.lpstrInitialDir = NULL;
		ofn.Flags = OFN_OVERWRITEPROMPT;
		if (GetSaveFileName(&amp;ofn)==TRUE) 
		{
			char *lpBuffer = new char[GetEditTextLength(hContentWindow)];
			GetWindowText(hContentWindow, lpBuffer, GetEditTextLength(hContentWindow));
			SaveToFile(ofn.lpstrFile, lpBuffer, GetEditTextLength(hContentWindow));
		}
	}
	if(mode == FALSE) 
	{
		OPENFILENAME ofn2;
		char szFile[260];      
		ZeroMemory(&amp;ofn2, sizeof(ofn2));
		ofn2.lStructSize = sizeof(ofn2);
		ofn2.hwndOwner = hwnd;
		ofn2.lpstrFile = szFile;
		ofn2.lpstrFile[0] = '\0';
		ofn2.nMaxFile = sizeof(szFile);
		ofn2.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
		ofn2.nFilterIndex = 1;
		ofn2.lpstrFileTitle = NULL;
		ofn2.nMaxFileTitle = 0;
		ofn2.lpstrInitialDir = NULL;
		ofn2.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
		if (GetOpenFileName(&amp;ofn2)==TRUE) 
		{
			SetWindowText(hContentWindow, LoadFileToObj(ofn2.lpstrFile, hFileWindow));
		}
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/548060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/548060</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Fri, 25 Jun 2004 17:11:21 GMT</pubDate></item><item><title><![CDATA[Reply to datei erneut öffnen-&amp;gt;FEHLER on Fri, 25 Jun 2004 18:07:19 GMT]]></title><description><![CDATA[<p>Ist irgendwie logisch, Du öffnest Sie, schließt sie aber nie...</p>
<p>Man lese die MSDN bezüglich CreateFile etwas genauer...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/548088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/548088</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Fri, 25 Jun 2004 18:07:19 GMT</pubDate></item><item><title><![CDATA[Reply to datei erneut öffnen-&amp;gt;FEHLER on Fri, 25 Jun 2004 19:53:40 GMT]]></title><description><![CDATA[<p>ach da muss man auch wieder schliessen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> ja ok ich werds lesen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/548149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/548149</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Fri, 25 Jun 2004 19:53:40 GMT</pubDate></item></channel></rss>