<?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[Bild in SDI-Anwendung laden]]></title><description><![CDATA[<p>Tag,</p>
<p>ich habe noch eine Frage für heute:</p>
<pre><code class="language-cpp">void CDispBmpDoc::Serialize(CArchive&amp; ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
        if (m_hBitmap != NULL)
            ::DeleteObject(m_hBitmap);
		stringstream name;

		name &lt;&lt; ORDNER &lt;&lt; &quot;/bild0001.bmp&quot;;
        m_hBitmap = (HBITMAP)::LoadImage(0,ar.m_strFileName,
                                        IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
        if (m_hBitmap==NULL) AfxMessageBox(_T(&quot;Kann Bitmap nicht öffnen!&quot;),MB_OK);
	}
}
</code></pre>
<p>Dieser Code funktioniert ok. Nun will ich aber keine User-Abfrage machen, sondern das Programm soll automatisch das Bild in 'name' hochladen, ohne dass das Eingabefenster erscheint.</p>
<p>Wie funktioniert das?</p>
<p>DANKE.<br />
H.W.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/171057/bild-in-sdi-anwendung-laden</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 13:47:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/171057.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Jan 2007 09:58:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bild in SDI-Anwendung laden on Mon, 22 Jan 2007 09:58:29 GMT]]></title><description><![CDATA[<p>Tag,</p>
<p>ich habe noch eine Frage für heute:</p>
<pre><code class="language-cpp">void CDispBmpDoc::Serialize(CArchive&amp; ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
        if (m_hBitmap != NULL)
            ::DeleteObject(m_hBitmap);
		stringstream name;

		name &lt;&lt; ORDNER &lt;&lt; &quot;/bild0001.bmp&quot;;
        m_hBitmap = (HBITMAP)::LoadImage(0,ar.m_strFileName,
                                        IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
        if (m_hBitmap==NULL) AfxMessageBox(_T(&quot;Kann Bitmap nicht öffnen!&quot;),MB_OK);
	}
}
</code></pre>
<p>Dieser Code funktioniert ok. Nun will ich aber keine User-Abfrage machen, sondern das Programm soll automatisch das Bild in 'name' hochladen, ohne dass das Eingabefenster erscheint.</p>
<p>Wie funktioniert das?</p>
<p>DANKE.<br />
H.W.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1214292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1214292</guid><dc:creator><![CDATA[Hans Wurst]]></dc:creator><pubDate>Mon, 22 Jan 2007 09:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to Bild in SDI-Anwendung laden on Mon, 22 Jan 2007 10:43:06 GMT]]></title><description><![CDATA[<p>Was meinst Du damit?<br />
Eine &quot;User-Abfrage&quot; nach dem Namen der zu speichernden Datei oder was?</p>
<p>Du müsstest einfach OnFileSave überschreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1214330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1214330</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 22 Jan 2007 10:43:06 GMT</pubDate></item><item><title><![CDATA[Reply to Bild in SDI-Anwendung laden on Mon, 22 Jan 2007 11:14:01 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Was meinst Du damit?<br />
Eine &quot;User-Abfrage&quot; nach dem Namen der zu speichernden Datei oder was?</p>
</blockquote>
<p>Ich meine, dass das Bild in 'name' automatisch hochgeladen werden soll, ohne dass der User darauf einen Einfluß hat. So wie es jetzt ist, ist zu Beginn der Hintergrund weiss. Erst wenn ich in meiner SDI-Anwendung auf 'File Open' gehe, dann kann der User irgendein BMP auswählen. Das brauche ich aber für meine Anwendung nicht.</p>
<p>Vielen Dank.<br />
H.W.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1214346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1214346</guid><dc:creator><![CDATA[Hans Wurst]]></dc:creator><pubDate>Mon, 22 Jan 2007 11:14:01 GMT</pubDate></item><item><title><![CDATA[Reply to Bild in SDI-Anwendung laden on Tue, 23 Jan 2007 02:55:15 GMT]]></title><description><![CDATA[<p>schau mal hier nach:<br />
<a href="http://www.functionx.com/visualc/views/DisplayBitmap.htm" rel="nofollow">http://www.functionx.com/visualc/views/DisplayBitmap.htm</a></p>
<pre><code class="language-cpp">void CShowPicture1View::OnDraw(CDC* pDC)
{
	CShowPicture1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	strFilename = &quot;C:/IRGENDWO/img0000.bmp&quot;;

	if(strFilename != &quot;&quot; )
	{
		BITMAP bmpProperties;

		// Create a bitmap handle using the name of the file
		HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL,strFilename,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

		CBitmap bmpPicture;
		CDC mdcPicture;

		// Convert the Win32 bitmap handle into an MFC bitmap object
		CBitmap *bmpFromHandle = bmpPicture.FromHandle(bmpHandle);
		bmpPicture.Attach(bmpHandle);

		// Call the Win32 GetObject() function to get the properties of the bitmap and store them in a BITMAP structure
		::GetObject(bmpPicture,sizeof(bmpProperties),&amp;bmpProperties);

		// Create a compatible device context
		mdcPicture.CreateCompatibleDC(pDC);
		// Select the bitmap into the device context
		CBitmap * bmpPrevious = mdcPicture.SelectObject(bmpFromHandle);

		// Using the dimensions store in the BITMAP object, // display the picture
		pDC-&gt;BitBlt(0, 0,bmpProperties.bmWidth, bmpProperties.bmHeight, &amp;mdcPicture, 0, 0, SRCCOPY);

		// Get the dimensions of the new picture
		SIZE sizeTotal;
		sizeTotal.cx = bmpProperties.bmWidth;
		sizeTotal.cy = bmpProperties.bmHeight;
		// Change the scrolling area/dimensions of the view
		SetScrollSizes(MM_TEXT, sizeTotal);

		// Restore the bitmap
		pDC-&gt;SelectObject(bmpPrevious);
		// Delete the Win32 bitmap handle
		DeleteObject(bmpHandle);
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1214896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1214896</guid><dc:creator><![CDATA[stick_thai]]></dc:creator><pubDate>Tue, 23 Jan 2007 02:55:15 GMT</pubDate></item><item><title><![CDATA[Reply to Bild in SDI-Anwendung laden on Tue, 23 Jan 2007 07:15:06 GMT]]></title><description><![CDATA[<p>Dann platziere doch in OnFileNew den entsprechenden Code. Oder wenn das Dein leeres Dokument ist verwende DeleteContents obwohl das schon wieder unsinnig scheint.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1214920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1214920</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 23 Jan 2007 07:15:06 GMT</pubDate></item></channel></rss>