<?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[bitmap aus resourcen datei wird nicht angezeigt]]></title><description><![CDATA[<pre><code class="language-cpp">/*---------------------------------------------------------
   SYSMETS1.C -- Ermittlung der Maße des Systems, Version 1
                 (c) Charles Petzold, 1998
  ---------------------------------------------------------*/
#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

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

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;SysMets1&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

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

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateWindow (szAppName, TEXT (&quot;Metriken des Systems, V 1&quot;),
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInstance, NULL) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc, hdcMem;
	PAINTSTRUCT ps;
	BITMAP bitmap;
	HBITMAP hBitmap;
	HINSTANCE hInstance;

     switch (message)
     {
     case WM_CREATE:
		  hInstance=((LPCREATESTRUCT)lParam)-&gt;hInstance;
		  hBitmap=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
		  GetObject(hBitmap, sizeof(BITMAP), &amp;bitmap);
          return 0 ;

     case WM_PAINT :
		  hdc=BeginPaint(hwnd, &amp;ps);
		  hdcMem=CreateCompatibleDC(hdc);
		  SelectObject(hdcMem, hBitmap);
		  BitBlt(hdc, 50,50, bitmap.bmWidth, bitmap.bmHeight, hdcMem,0,0,SRCCOPY);
		  DeleteDC(hdcMem);
		  EndPaint(hwnd, &amp;ps);
          return 0 ;

     case WM_DESTROY :
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
<p>resource.h:</p>
<blockquote>
<p>//{{NO_DEPENDENCIES}}<br />
// Microsoft Developer Studio generated include file.<br />
// Used by icondemo.rc<br />
//<br />
#define IDB_BITMAP1 101</p>
<p>// Next default values for new objects<br />
//<br />
#ifdef APSTUDIO_INVOKED<br />
#ifndef APSTUDIO_READONLY_SYMBOLS<br />
#define _APS_NEXT_RESOURCE_VALUE 102<br />
#define _APS_NEXT_COMMAND_VALUE 40001<br />
#define _APS_NEXT_CONTROL_VALUE 1000<br />
#define _APS_NEXT_SYMED_VALUE 101<br />
#endif<br />
#endif</p>
</blockquote>
<p>icondemo.rc:</p>
<blockquote>
<p>//Microsoft Developer Studio generated resource script.<br />
//<br />
#include &quot;resource.h&quot;</p>
<p>#define APSTUDIO_READONLY_SYMBOLS<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Generated from the TEXTINCLUDE 2 resource.<br />
//<br />
#include &quot;afxres.h&quot;</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
#undef APSTUDIO_READONLY_SYMBOLS</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
// Deutsch (Deutschland) resources</p>
<p>#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)<br />
#ifdef _WIN32<br />
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN<br />
#pragma code_page(1252)<br />
#endif //_WIN32</p>
<p>#ifdef APSTUDIO_INVOKED<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// TEXTINCLUDE<br />
//</p>
<p>1 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;resource.h\0&quot;<br />
END</p>
<p>2 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;#include &quot;&quot;afxres.h&quot;&quot;\r\n&quot;<br />
&quot;\0&quot;<br />
END</p>
<p>3 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;\r\n&quot;<br />
&quot;\0&quot;<br />
END</p>
<p>#endif // APSTUDIO_INVOKED</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Bitmap<br />
//</p>
<p>IDB_BITMAP1 BITMAP DISCARDABLE &quot;bitmap1.bmp&quot;<br />
#endif // Deutsch (Deutschland) resources<br />
/////////////////////////////////////////////////////////////////////////////</p>
<p>#ifndef APSTUDIO_INVOKED<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Generated from the TEXTINCLUDE 3 resource.<br />
//</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
#endif // not APSTUDIO_INVOKED</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/topic/95947/bitmap-aus-resourcen-datei-wird-nicht-angezeigt</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 18:29:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/95947.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Dec 2004 00:24:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 00:24:10 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">/*---------------------------------------------------------
   SYSMETS1.C -- Ermittlung der Maße des Systems, Version 1
                 (c) Charles Petzold, 1998
  ---------------------------------------------------------*/
#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

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

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;SysMets1&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

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

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateWindow (szAppName, TEXT (&quot;Metriken des Systems, V 1&quot;),
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInstance, NULL) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc, hdcMem;
	PAINTSTRUCT ps;
	BITMAP bitmap;
	HBITMAP hBitmap;
	HINSTANCE hInstance;

     switch (message)
     {
     case WM_CREATE:
		  hInstance=((LPCREATESTRUCT)lParam)-&gt;hInstance;
		  hBitmap=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
		  GetObject(hBitmap, sizeof(BITMAP), &amp;bitmap);
          return 0 ;

     case WM_PAINT :
		  hdc=BeginPaint(hwnd, &amp;ps);
		  hdcMem=CreateCompatibleDC(hdc);
		  SelectObject(hdcMem, hBitmap);
		  BitBlt(hdc, 50,50, bitmap.bmWidth, bitmap.bmHeight, hdcMem,0,0,SRCCOPY);
		  DeleteDC(hdcMem);
		  EndPaint(hwnd, &amp;ps);
          return 0 ;

     case WM_DESTROY :
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
<p>resource.h:</p>
<blockquote>
<p>//{{NO_DEPENDENCIES}}<br />
// Microsoft Developer Studio generated include file.<br />
// Used by icondemo.rc<br />
//<br />
#define IDB_BITMAP1 101</p>
<p>// Next default values for new objects<br />
//<br />
#ifdef APSTUDIO_INVOKED<br />
#ifndef APSTUDIO_READONLY_SYMBOLS<br />
#define _APS_NEXT_RESOURCE_VALUE 102<br />
#define _APS_NEXT_COMMAND_VALUE 40001<br />
#define _APS_NEXT_CONTROL_VALUE 1000<br />
#define _APS_NEXT_SYMED_VALUE 101<br />
#endif<br />
#endif</p>
</blockquote>
<p>icondemo.rc:</p>
<blockquote>
<p>//Microsoft Developer Studio generated resource script.<br />
//<br />
#include &quot;resource.h&quot;</p>
<p>#define APSTUDIO_READONLY_SYMBOLS<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Generated from the TEXTINCLUDE 2 resource.<br />
//<br />
#include &quot;afxres.h&quot;</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
#undef APSTUDIO_READONLY_SYMBOLS</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
// Deutsch (Deutschland) resources</p>
<p>#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)<br />
#ifdef _WIN32<br />
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN<br />
#pragma code_page(1252)<br />
#endif //_WIN32</p>
<p>#ifdef APSTUDIO_INVOKED<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// TEXTINCLUDE<br />
//</p>
<p>1 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;resource.h\0&quot;<br />
END</p>
<p>2 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;#include &quot;&quot;afxres.h&quot;&quot;\r\n&quot;<br />
&quot;\0&quot;<br />
END</p>
<p>3 TEXTINCLUDE DISCARDABLE<br />
BEGIN<br />
&quot;\r\n&quot;<br />
&quot;\0&quot;<br />
END</p>
<p>#endif // APSTUDIO_INVOKED</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Bitmap<br />
//</p>
<p>IDB_BITMAP1 BITMAP DISCARDABLE &quot;bitmap1.bmp&quot;<br />
#endif // Deutsch (Deutschland) resources<br />
/////////////////////////////////////////////////////////////////////////////</p>
<p>#ifndef APSTUDIO_INVOKED<br />
/////////////////////////////////////////////////////////////////////////////<br />
//<br />
// Generated from the TEXTINCLUDE 3 resource.<br />
//</p>
<p>/////////////////////////////////////////////////////////////////////////////<br />
#endif // not APSTUDIO_INVOKED</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/680845</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/680845</guid><dc:creator><![CDATA[fies]]></dc:creator><pubDate>Sun, 26 Dec 2004 00:24:10 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 00:33:59 GMT]]></title><description><![CDATA[<p>Ja, dann ersma Rückgabewerte prüfen <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=";D"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/680846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/680846</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 26 Dec 2004 00:33:59 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 10:41:31 GMT]]></title><description><![CDATA[<p>Mach bitmap und hBitmap mal static.</p>
<pre><code class="language-cpp">static BITMAP bitmap;
static HBITMAP hBitmap;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/680904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/680904</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Sun, 26 Dec 2004 10:41:31 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 12:20:23 GMT]]></title><description><![CDATA[<p>Jippie. Danke!!<br />
- Aber warum static?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/680957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/680957</guid><dc:creator><![CDATA[fies]]></dc:creator><pubDate>Sun, 26 Dec 2004 12:20:23 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 12:25:27 GMT]]></title><description><![CDATA[<p>fies schrieb:</p>
<blockquote>
<p>Jippie. Danke!!<br />
- Aber warum static?</p>
</blockquote>
<p>wenn du die WndProc verlässt zerstörst du variablen, static vars bleiben im speicher.</p>
<p>lebensdauer<br />
<a href="http://tutorial.schornboeck.net/scope.htm" rel="nofollow">http://tutorial.schornboeck.net/scope.htm</a><br />
static<br />
<a href="http://tutorial.schornboeck.net/static.htm" rel="nofollow">http://tutorial.schornboeck.net/static.htm</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/680961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/680961</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Sun, 26 Dec 2004 12:25:27 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 14:11:45 GMT]]></title><description><![CDATA[<p>Habe ein weiteres Problem.</p>
<pre><code class="language-cpp">//Variablen für Bild
    HDC hdc, hdcMem; 
    PAINTSTRUCT ps; 
    static BITMAP bitmap; 
    static HBITMAP hBitmap; 
    HINSTANCE hInstance; 

	//Variablen für Button
	static HWND hwndSmaller;

     switch (message) 
     { 
     case WM_CREATE:
		 {//Bild vorbereiten
          hInstance=((LPCREATESTRUCT)lParam)-&gt;hInstance; 
          hBitmap=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)); 
          GetObject(hBitmap, sizeof(BITMAP), &amp;bitmap); 

		  //Button vorbereiten
		  hwndSmaller=CreateWindow(NULL,NULL,
									WS_CHILD|WS_VISIBLE|BS_BITMAP,
									0,0,80,80,
									hwnd,(HMENU)300,hInstance,NULL);
		  SendMessage(hwndSmaller,BM_SETIMAGE ,IMAGE_BITMAP, hBitmap);
</code></pre>
<p>Ich möchte eine Bitmap als Button definieren aber irgendwie wird er nicht angezeigt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/681066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/681066</guid><dc:creator><![CDATA[fies]]></dc:creator><pubDate>Sun, 26 Dec 2004 14:11:45 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 14:15:19 GMT]]></title><description><![CDATA[<p>Du willst als Fensterklasse bestimmt eher &quot;BUTTON&quot; als NULL benutzen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/681076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/681076</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 26 Dec 2004 14:15:19 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 14:21:43 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">//Button vorbereiten
		  hwndSmaller=CreateWindow(TEXT(&quot;BUTTON&quot;),NULL,
									WS_CHILD|WS_VISIBLE|BS_BITMAP,
									50,90,80,80,
									hwnd,(HMENU)300,hInstance,NULL);
		  SendMessage(hwndSmaller,BM_SETIMAGE , (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);
</code></pre>
<p>Funxt leider immer noch nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/681086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/681086</guid><dc:creator><![CDATA[fies]]></dc:creator><pubDate>Sun, 26 Dec 2004 14:21:43 GMT</pubDate></item><item><title><![CDATA[Reply to bitmap aus resourcen datei wird nicht angezeigt on Sun, 26 Dec 2004 14:28:23 GMT]]></title><description><![CDATA[<p>Hier funktionierts nicht:</p>
<pre><code class="language-cpp">//Button vorbereiten
		  hwndSmaller=CreateWindow(TEXT(&quot;BUTTON&quot;),NULL,
									WS_CHILD|WS_VISIBLE|BS_BITMAP,
									50,90,80,80,
									hwnd,(HMENU)300,hInstance,NULL);
		  //if(hwndSmaller!=NULL) MessageBox(0,&quot;lol&quot;,0,0);
		  SendMessage(hwndSmaller,BM_SETIMAGE , (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);
</code></pre>
<p>Hier wird der Button angezeigt:</p>
<pre><code class="language-cpp">//Button vorbereiten
		  hwndSmaller=CreateWindow(TEXT(&quot;BUTTON&quot;),NULL,
									WS_CHILD|WS_VISIBLE|BS_BITMAP,
									50,90,80,80,
									hwnd,(HMENU)300,hInstance,NULL);
		  if(hwndSmaller!=NULL) MessageBox(0,&quot;lol&quot;,0,0);
		  SendMessage(hwndSmaller,BM_SETIMAGE , (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);
</code></pre>
<p>...Hallo - warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/681095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/681095</guid><dc:creator><![CDATA[fies]]></dc:creator><pubDate>Sun, 26 Dec 2004 14:28:23 GMT</pubDate></item></channel></rss>