<?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[In eine RichEditBox ohne MFC ein Icon ?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin momentan dabei einen kleinen Chat zu schreiben.<br />
Nun stelle ich mir jedoch die Frage, wie ich ein Icon (z.B. Smilie)<br />
in eine RichEditBox bekomme, ohne MFC.</p>
<p>Könnt ihr mir helfen?</p>
<p>Vielen Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/77294/in-eine-richeditbox-ohne-mfc-ein-icon</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 21:44:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/77294.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Jun 2004 18:17:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 18:17:06 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin momentan dabei einen kleinen Chat zu schreiben.<br />
Nun stelle ich mir jedoch die Frage, wie ich ein Icon (z.B. Smilie)<br />
in eine RichEditBox bekomme, ohne MFC.</p>
<p>Könnt ihr mir helfen?</p>
<p>Vielen Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/543865</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543865</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Sat, 19 Jun 2004 18:17:06 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 18:25:09 GMT]]></title><description><![CDATA[<p>Es scheint nicht so eine einfache Sache sein, ein Bild in ein RichtEdit Control einzufügen. Schau mal ob du was in den Google Groups findest: <a href="http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;q=richedit+insert+icon%7Cimage+%2Bmicrosoft&amp;btnG=Search" rel="nofollow">http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;q=richedit+insert+icon|image+%2Bmicrosoft&amp;btnG=Search</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/543869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543869</guid><dc:creator><![CDATA[Aziz]]></dc:creator><pubDate>Sat, 19 Jun 2004 18:25:09 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 18:38:18 GMT]]></title><description><![CDATA[<p>Nein leider nichts brauchbares bei <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>Danke dir trotzdem!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/543877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543877</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Sat, 19 Jun 2004 18:38:18 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 18:57:07 GMT]]></title><description><![CDATA[<p><a href="http://www.codeguru.com/Cpp/controls/richedit/article.php/c5383/" rel="nofollow">http://www.codeguru.com/Cpp/controls/richedit/article.php/c5383/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/543884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543884</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Sat, 19 Jun 2004 18:57:07 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 19:33:26 GMT]]></title><description><![CDATA[<p>Das Tutorial hab ich mir auch schon angesehen!<br />
Das Problem daran ist, dass keine Includes dabei stehen und ich somit massenweise fehler bekomme.</p>
<p>Ich hab mir darauf hin das Beispiel Source runtergeladen...<br />
Nur das iss leider wieder MFC <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>Hat jemand evtl ein gutes deutsches Tutorial oder ein Code Sniplet?</p>
<p>Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/543906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543906</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Sat, 19 Jun 2004 19:33:26 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 20:10:34 GMT]]></title><description><![CDATA[<p>Du musst wohl diese Header in die Klassen-Header einbinden (und die lokale afx-irgendwas-Header rausschmeißen):<br />
#include&lt;olestd.h&gt;<br />
#include&lt;Richedit.H&gt;<br />
#include&lt;Richole.h&gt;</p>
<p>Diese Zeilen habe ich auch auskommentiert:<br />
#ifdef <em>DEBUG<br />
#undef THIS_FILE<br />
static char THIS_FILE[]=__FILE</em>_;<br />
#define new DEBUG_NEW<br />
#endif</p>
<p>dann kommen bei mir nur noch Fehler bei ASSERT, VERIFY und AfxThrowOleException() diese Makros und Funktionen brauchst du ja eigentlich nicht und kannst ja die Klasse ein wenig abändern. Dann kompiliert es schon mal ohne Fehler. Dieses komische RicheditInterface bekommst du ja über eine Message, wie im Link beschrieben und dann kannst du der Klasse doch schon ein HBITMAP zukommen lassen InsertBitmap(blablabla).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/543925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543925</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Sat, 19 Jun 2004 20:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 21:31:22 GMT]]></title><description><![CDATA[<p>Das teste ich gleich morgen mal!</p>
<p>Danke so weit!</p>
<p>HBITMAP wird doch im normalfall aus einer Datei geladen,<br />
gibts da auch nen weg es aus der Ressourcedatei zu laden?</p>
<p>Evtl. per LoadIcon ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/543975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543975</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Sat, 19 Jun 2004 21:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sat, 19 Jun 2004 21:43:52 GMT]]></title><description><![CDATA[<p>'s gibt doch eh LoadBitmap() <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/543978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/543978</guid><dc:creator><![CDATA[Aziz]]></dc:creator><pubDate>Sat, 19 Jun 2004 21:43:52 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Sun, 20 Jun 2004 22:16:42 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab das jetz mal ausprobiert...<br />
Aber irgent wie funktioniert es bei mir nicht...<br />
Mit einfach dem Assert usw rausnehmen ist es nicht getahn...<br />
So bekomm ich jedes mal Speicherzugrifsfehler <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>Hat jemand ein kleines simples Code Sniplet für mich?</p>
<p>Vielen Dank soweit an alle!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/544576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/544576</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Sun, 20 Jun 2004 22:16:42 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Mon, 21 Jun 2004 06:04:10 GMT]]></title><description><![CDATA[<p>Debugger - und dann zeig doch mal die betreffende Codestelle mit der Zugriffsverletzung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/544613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/544613</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 21 Jun 2004 06:04:10 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Tue, 22 Jun 2004 17:27:53 GMT]]></title><description><![CDATA[<p>Also ich hab jetz nochmal<br />
die Classe eingefügt, die Header declariert und die entsprechenden Zeilen auskommentiert...</p>
<p>Dann habe ich mein Projekt mit debug gestartet und raus kahm:</p>
<p>Unbehandelte Ausnahme in Chat Client.exe:0xC0000005: Access Violation</p>
<p>Zum einfügen eines Icons hab ich dies gemacht:</p>
<pre><code class="language-cpp">void AddIcon( void )
{
	::SendMessage( Edit_ChatText, EM_GETOLEINTERFACE, 0, (LPARAM)&amp;m_pRichEditOle);

	HBITMAP hBitmap = LoadBitmap( hInst, MAKEINTRESOURCE( IDB_BITMAP1 ) );

	if (hBitmap)
	{
		CImageDataObject::InsertBitmap(m_pRichEditOle, hBitmap);
	}
}
</code></pre>
<p>Wobei pRichEditOle so declariert ist:<br />
IRichEditOle *m_pRichEditOle;</p>
<p>Das Edit_ChatText ist folgendermassen declariert:</p>
<p>HWND Edit_ChatText;</p>
<p>und wird in der Init des Proggys folgendermassen gefüllt:</p>
<pre><code class="language-cpp">Edit_ChatText = CreateWindowEx(WS_EX_CLIENTEDGE,RICHEDIT_CLASS,&quot;&quot;, WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_READONLY, 0, 0, 645, 529, hWnd, (HMENU)Edit_ChatTextID, hInst, NULL);
			SendMessage(Edit_ChatText, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
</code></pre>
<p>Dazu muss ich sagen, dass das Create der Rich Edit Box auf jeden fall vor dem Insert geschieht !</p>
<p>Ich hoffe ihr könnt mir helfen !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/545934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/545934</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Tue, 22 Jun 2004 17:27:53 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Tue, 22 Jun 2004 20:26:34 GMT]]></title><description><![CDATA[<p>In welcher Zeile genau kommt denn die Zugriffsverletzung - Breakpoint setzen oder Schritt für Schritt ausführen lassen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/546056</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546056</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Tue, 22 Jun 2004 20:26:34 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Tue, 22 Jun 2004 20:32:01 GMT]]></title><description><![CDATA[<p>Es scheint<br />
CImageDataObject::InsertBitmap(m_pRichEditOle, hBitmap);<br />
zu sein...</p>
<p>Wenn ich die Zeile auskommentiere funzt es alles ordentlich!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546062</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Tue, 22 Jun 2004 20:32:01 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Tue, 22 Jun 2004 20:39:41 GMT]]></title><description><![CDATA[<p>Ist m_pRichEditOle dort gültig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546066</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Tue, 22 Jun 2004 20:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Tue, 22 Jun 2004 21:30:24 GMT]]></title><description><![CDATA[<p>Ja ist es!</p>
<p>pRichEditOle declariere ich global!</p>
<p>So ist der gesamte code der add routine:</p>
<pre><code class="language-cpp">void AddIcon( void ) 
{ 
    ::SendMessage( Edit_ChatText, EM_GETOLEINTERFACE, 0, (LPARAM)&amp;m_pRichEditOle); 

    HBITMAP hBitmap = LoadBitmap( hInst, MAKEINTRESOURCE( IDB_BITMAP1 ) ); 

    if (hBitmap) 
    { 
        CImageDataObject::InsertBitmap(m_pRichEditOle, hBitmap); 
    } 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/546096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546096</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Tue, 22 Jun 2004 21:30:24 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 06:34:31 GMT]]></title><description><![CDATA[<p>Was liefert der SendMessage-Aufruf zurück?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546203</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 23 Jun 2004 06:34:31 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 06:41:36 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habs jetz mal so getestet:</p>
<pre><code class="language-cpp">if ( SendMessage( Edit_ChatText, EM_GETOLEINTERFACE, 0, (LPARAM)&amp;m_pRichEditOle) == 0 )
{
	MessageBox( NULL, &quot;RichEdit Ole = 0&quot;, &quot;&quot;, MB_OK );	
}
</code></pre>
<p>Die MessageBox kommt nicht hoch also geh ich mal davon aus, dass das Succeded ist... <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>
]]></description><link>https://www.c-plusplus.net/forum/post/546205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546205</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 06:41:36 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:17:45 GMT]]></title><description><![CDATA[<p>Hast du mal geschaut, wo innerhalb von CImageDataObject::InsertBitmap der Fehler auftritt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546230</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:17:45 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:23:31 GMT]]></title><description><![CDATA[<p>Erstmal Danke das du mir hilfst!</p>
<p>Der Fehler tritt hier auf:</p>
<pre><code class="language-cpp">sc = pOleObject-&gt;GetUserClassID(&amp;clsid);
</code></pre>
<p>Im InsertBitmap.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546232</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546232</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:35:21 GMT]]></title><description><![CDATA[<p>Und OleCreateStaticFromData in CImageDataObject::GetOleObject liefert S_OK zurück? Irgendwie ist das alles etwas merkwürdig <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/546241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546241</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:35:21 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:36:55 GMT]]></title><description><![CDATA[<p>Ich hab das gerade noch mal weiter ausgetestet....</p>
<p>Ich denke das Problem liegt hier:</p>
<pre><code class="language-cpp">IOleObject *pOleObject; 
pOleObject = pods-&gt;GetOleObject(pOleClientSite, pStorage);

OleSetContainedObject(pOleObject, TRUE);
</code></pre>
<p>Danach ist pOleObject = 0x00000000</p>
<p>Was ja auf einen Fehler schliessen lässt...</p>
<p>pOleClientSite ist = 0x00159750<br />
und pStorage = 0x00168e60</p>
<p>Ich hoffe du kanst mir helfen !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546243</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:36:55 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:38:08 GMT]]></title><description><![CDATA[<p>Gleichzeitig drauf gekommen *G* Nu fehlt nur die Lösung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/546247</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546247</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:38:08 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 07:56:03 GMT]]></title><description><![CDATA[<p>Kann dir da leider auch nicht weiterhelfen - du musst eben mal die CImageDataObject::GetOleObject Memberfunktion untersuchen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/546256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546256</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 23 Jun 2004 07:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 08:04:02 GMT]]></title><description><![CDATA[<p>Also der Fehler liegt definitief hier:</p>
<pre><code class="language-cpp">IOleObject *CImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStorage *pStorage)
{
	SCODE sc;
	IOleObject *pOleObject;
	sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &amp;m_fromat, pOleClientSite, pStorage, (void **)&amp;pOleObject);

	return pOleObject;
}
</code></pre>
<p>Kommentier ich den aufruf und:</p>
<pre><code class="language-cpp">sc = pOleObject-&gt;GetUserClassID(&amp;clsid);
</code></pre>
<p>aus, dann bekomme ich ein Blankes Transparentes Feld in der RicheditBox...</p>
<p>Kann es sein, dass es daran liegt, dass ich beim InsertBitmap evtl ein falsches oder fehlerhaftes bild übergebe ?</p>
<pre><code class="language-cpp">if ( SendMessage( Edit_ChatText, EM_GETOLEINTERFACE, 0, (LPARAM)&amp;m_pRichEditOle) == 0 )
	{
		MessageBox( NULL, &quot;RichEdit Ole = 0&quot;, &quot;&quot;, MB_OK );	
	}

	HBITMAP hBitmap = LoadBitmap( hInst, MAKEINTRESOURCE( IDB_BITMAP1 ) );

	if (hBitmap)
	{
		CImageDataObject::InsertBitmap(m_pRichEditOle, hBitmap);
	}
</code></pre>
<p>ist ein bild welches ich in der Ressource Datei habe!</p>
<p>Danke soweit !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546265</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 08:04:02 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 17:23:13 GMT]]></title><description><![CDATA[<p>Kann mir den wirklich keiner helfen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/546617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546617</guid><dc:creator><![CDATA[Karigos]]></dc:creator><pubDate>Wed, 23 Jun 2004 17:23:13 GMT</pubDate></item><item><title><![CDATA[Reply to In eine RichEditBox ohne MFC ein Icon ? on Wed, 23 Jun 2004 19:38:25 GMT]]></title><description><![CDATA[<p>Ich kann dir auch nicht helfen, aber ich habe mir gerade einfach mal den Code zusammenkopiert und bei mir läuft es. Das Bitmap wird aus C:\test.bmp geladen.</p>
<pre><code>/*-----------------------------------------------------------------------
Muster Window.cpp 

www.winapi.net
-----------------------------------------------------------------------*/

#include &lt;windows.h&gt;
#include &lt;Richedit.h&gt;
#include &lt;richole.h&gt;

class CImageDataObject : IDataObject
{
public: 
	// This static function accepts a pointer to IRochEditOle 
	//   and the bitmap handle.
	// After that the function insert the image in the current 
	//   position of the RichEdit
	//
	static void InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
	{
		SCODE sc;

		// Get the image data object
		//
		CImageDataObject *pods = new CImageDataObject;
		LPDATAOBJECT lpDataObject;
		pods-&gt;QueryInterface(IID_IDataObject, (void **)&amp;lpDataObject);

		pods-&gt;SetBitmap(hBitmap);

		// Get the RichEdit container site
		//
		IOleClientSite *pOleClientSite;	
		pRichEditOle-&gt;GetClientSite(&amp;pOleClientSite);

		// Initialize a Storage Object
		//
		IStorage *pStorage;	

		LPLOCKBYTES lpLockBytes = NULL;
		sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &amp;lpLockBytes);

		sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
			STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &amp;pStorage);
		if (sc != S_OK)
		{
			lpLockBytes = NULL;
		}

		// The final ole object which will be inserted in the richedit control
		//
		IOleObject *pOleObject; 
		pOleObject = pods-&gt;GetOleObject(pOleClientSite, pStorage);

		// all items are &quot;contained&quot; -- this makes our reference to this object
		//  weak -- which is needed for links to embedding silent update.
		OleSetContainedObject(pOleObject, TRUE);

		// Now Add the object to the RichEdit 
		//
		REOBJECT reobject;
		ZeroMemory(&amp;reobject, sizeof(REOBJECT));
		reobject.cbStruct = sizeof(REOBJECT);

		CLSID clsid;
		sc = pOleObject-&gt;GetUserClassID(&amp;clsid);

		reobject.clsid = clsid;
		reobject.cp = REO_CP_SELECTION;
		reobject.dvaspect = DVASPECT_CONTENT;
		reobject.poleobj = pOleObject;
		reobject.polesite = pOleClientSite;
		reobject.pstg = pStorage;

		// Insert the bitmap at the current location in the richedit control
		//
		pRichEditOle-&gt;InsertObject(&amp;reobject);

		// Release all unnecessary interfaces
		//
		pOleObject-&gt;Release();
		pOleClientSite-&gt;Release();
		pStorage-&gt;Release();
		lpDataObject-&gt;Release();
	}
private:
	ULONG m_ulRefCnt;
	BOOL  m_bRelease;

	// The data being bassed to the richedit
	//
	STGMEDIUM m_stgmed;
	FORMATETC m_fromat;

public:
	CImageDataObject() : m_ulRefCnt(0) {
		m_bRelease = FALSE;
	}

	~CImageDataObject() {
		if (m_bRelease)
			::ReleaseStgMedium(&amp;m_stgmed);
	}

	// Methods of the IUnknown interface
	// 
	STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
	{
		if (iid == IID_IUnknown || iid == IID_IDataObject)
		{
			*ppvObject = this;
			AddRef();
			return S_OK;
		}
		else
			return E_NOINTERFACE;
	}
	STDMETHOD_(ULONG, AddRef)(void)
	{
		m_ulRefCnt++;
		return m_ulRefCnt;
	}
	STDMETHOD_(ULONG, Release)(void)
	{
		if (--m_ulRefCnt == 0)
		{
			delete this;
		}

		return m_ulRefCnt;
	}

	// Methods of the IDataObject Interface
	//
	STDMETHOD(GetData)(FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
	{
		HANDLE hDst;
		hDst = ::OleDuplicateData(m_stgmed.hBitmap, 
			CF_BITMAP, NULL);
		if (hDst == NULL)
		{
			return E_HANDLE;
		}

		pmedium-&gt;tymed = TYMED_GDI;
		pmedium-&gt;hBitmap = (HBITMAP)hDst;
		pmedium-&gt;pUnkForRelease = NULL;

		return S_OK;
	}
	STDMETHOD(GetDataHere)(FORMATETC* pformatetc, STGMEDIUM*  pmedium)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(QueryGetData)(FORMATETC*  pformatetc )
	{
		return E_NOTIMPL;
	}
	STDMETHOD(GetCanonicalFormatEtc)(FORMATETC*  pformatectIn, FORMATETC* pformatetcOut)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(SetData)(FORMATETC* pformatetc , STGMEDIUM*  pmedium , BOOL  fRelease)
	{
		m_fromat = *pformatetc;
		m_stgmed = *pmedium;

		return S_OK;
	}
	STDMETHOD(EnumFormatEtc)(DWORD  dwDirection , IEnumFORMATETC**  ppenumFormatEtc)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(DAdvise)(FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(DUnadvise)(DWORD dwConnection)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(EnumDAdvise)(IEnumSTATDATA **ppenumAdvise)
	{
		return E_NOTIMPL;
	}

	// Some Other helper functions
	//
	void SetBitmap(HBITMAP hBitmap)
	{
		STGMEDIUM stgm;
		stgm.tymed = TYMED_GDI;					// Storage medium = HBITMAP handle		
		stgm.hBitmap = hBitmap;
		stgm.pUnkForRelease = NULL;				// Use ReleaseStgMedium

		FORMATETC fm;
		fm.cfFormat = CF_BITMAP;				// Clipboard format = CF_BITMAP
		fm.ptd = NULL;							// Target Device = Screen
		fm.dwAspect = DVASPECT_CONTENT;			// Level of detail = Full content
		fm.lindex = -1;							// Index = Not applicaple
		fm.tymed = TYMED_GDI;					// Storage medium = HBITMAP handle

		this-&gt;SetData(&amp;fm, &amp;stgm, TRUE);	
	}

	IOleObject *GetOleObject(IOleClientSite *pOleClientSite, IStorage *pStorage)
	{
		SCODE sc;
		IOleObject *pOleObject;
		sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, 
			&amp;m_fromat, pOleClientSite, pStorage, (void **)&amp;pOleObject);
		return pOleObject;
	}
};

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

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
					PSTR szCmdLine, int iCmdShow)
{

	static TCHAR szAppName[] = TEXT (&quot;Klassenname&quot;);
	HWND         hwnd;
	MSG          msg;
	WNDCLASSEX   wndclassex = {0};

	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 0;
	}

	hwnd = CreateWindowEx (WS_EX_OVERLAPPEDWINDOW, // erweiterter Fensterstil
		szAppName, // Name der Fensterklasse
		TEXT (&quot;Fenstertitel&quot;), // Fenstertitel
		WS_OVERLAPPEDWINDOW, // Fensterstil
		CW_USEDEFAULT, // X-Position des Fensters                      
		CW_USEDEFAULT, // Y-Position des Fensters       
		CW_USEDEFAULT, // Fensterbreite                 
		CW_USEDEFAULT, // Fensterhöhe                
		NULL, // übergeordnetes Fenster
		NULL, // Menü           
		hInstance, // Programm-Kopiezähler (Programm-ID)            
		NULL); // zusätzliche Parameter

	ShowWindow (hwnd, iCmdShow);
	UpdateWindow (hwnd);

	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)
{

	switch (message)
	{
	case WM_CREATE:
		{
			LoadLibrary(&quot;riched20.dll&quot;);
			HWND hRichEdit = CreateWindowEx(0, RICHEDIT_CLASS, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 0, 0, 200, 200, hwnd, (HMENU) 0, GetModuleHandle(NULL), NULL);
			IRichEditOle* pRichEditOle = NULL;
			::SendMessage(hRichEdit, EM_GETOLEINTERFACE, 0, (LPARAM)&amp;pRichEditOle);
			HBITMAP hBitmap = (HBITMAP) LoadImage(NULL, TEXT(&quot;C:\\test.bmp&quot;), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); 
			CImageDataObject::InsertBitmap(pRichEditOle, hBitmap);
		}
		return (0);

	case WM_DESTROY:
		PostQuitMessage (0);
		return (0);
	}

	return DefWindowProc (hwnd, message, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/546699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/546699</guid><dc:creator><![CDATA[Trolli]]></dc:creator><pubDate>Wed, 23 Jun 2004 19:38:25 GMT</pubDate></item></channel></rss>