<?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[Ressource Bitmap darstellen]]></title><description><![CDATA[<pre><code class="language-cpp">#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;Gerätabhängige Bitmaps&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,                 // Name der Fensterklasse
                  szAppName,                          // 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 ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	 HDC hdc1, hdc, hdcmem;
	 PAINTSTRUCT ps;
     static BITMAP bitmap;
	 static int bw, bh;
	 int x, y;
	 HINSTANCE hInstance;
     switch (message)
     {
     case WM_CREATE:
		  hInstance = ((LPCREATESTRUCT) lParam)-&gt;hInstance;
		  HBITMAP hBitmap;
		  hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
		  GetObject(hBitmap, sizeof(BITMAP), &amp;bitmap);
		  bw = bitmap.bmWidth;
		  bh = bitmap.bmHeight;
          return 0 ;
     case WM_DESTROY:
		  DeleteObject(hBitmap);
          PostQuitMessage (0) ;
          return 0 ;
	 case WM_PAINT:
          hdc = BeginPaint(hwnd, &amp;ps);
		  hdcmem = CreateCompatibleDC(hdc);
		  SelectObject(hdcmem, hBitmap);
		  BitBlt(hdc, 50, 50, bw, bh, hdcmem, 0, 0, SRCCOPY);
		  DeleteDC(hdcmem);
		  EndPaint(hwnd, &amp;ps);
		  ReleaseDC(hwnd, hdc1);
		  return 0;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
<p>Wieso funktioniert das nicht?<br />
Ich habe die Bitmap als Ressource dazugetan.<br />
Der Anwendungsbereich ist aber nur weiß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/220546/ressource-bitmap-darstellen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 14:00:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/220546.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Aug 2008 22:09:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ressource Bitmap darstellen on Sun, 17 Aug 2008 22:09:26 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#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;Gerätabhängige Bitmaps&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,                 // Name der Fensterklasse
                  szAppName,                          // 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 ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	 HDC hdc1, hdc, hdcmem;
	 PAINTSTRUCT ps;
     static BITMAP bitmap;
	 static int bw, bh;
	 int x, y;
	 HINSTANCE hInstance;
     switch (message)
     {
     case WM_CREATE:
		  hInstance = ((LPCREATESTRUCT) lParam)-&gt;hInstance;
		  HBITMAP hBitmap;
		  hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
		  GetObject(hBitmap, sizeof(BITMAP), &amp;bitmap);
		  bw = bitmap.bmWidth;
		  bh = bitmap.bmHeight;
          return 0 ;
     case WM_DESTROY:
		  DeleteObject(hBitmap);
          PostQuitMessage (0) ;
          return 0 ;
	 case WM_PAINT:
          hdc = BeginPaint(hwnd, &amp;ps);
		  hdcmem = CreateCompatibleDC(hdc);
		  SelectObject(hdcmem, hBitmap);
		  BitBlt(hdc, 50, 50, bw, bh, hdcmem, 0, 0, SRCCOPY);
		  DeleteDC(hdcmem);
		  EndPaint(hwnd, &amp;ps);
		  ReleaseDC(hwnd, hdc1);
		  return 0;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
<p>Wieso funktioniert das nicht?<br />
Ich habe die Bitmap als Ressource dazugetan.<br />
Der Anwendungsbereich ist aber nur weiß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1566636</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1566636</guid><dc:creator><![CDATA[toObbias]]></dc:creator><pubDate>Sun, 17 Aug 2008 22:09:26 GMT</pubDate></item><item><title><![CDATA[Reply to Ressource Bitmap darstellen on Mon, 18 Aug 2008 07:31:43 GMT]]></title><description><![CDATA[<p>Dieser Code kann doch nicht gehen. hBitmap ist eine temporäere Variable.<br />
Vor allem wundert mich, dass Dein Compiler nicht motzt, de in dem einen case Zweig wird die Variable definiert und in einem anderen benutzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1566716</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1566716</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 18 Aug 2008 07:31:43 GMT</pubDate></item></channel></rss>