<?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 ohne DLL laden]]></title><description><![CDATA[<p>Also ich habe ein Proramm in dem ich ein Bild einbinden möchte.<br />
Dafür habe ich mir nun Informationen in Google gesucht und dem entsprechend einen Quellcode erstellt den ich ganz am ende mal poste.</p>
<p>Jedenfalls wird dort eine Konstante IDB_BALL verwendet.<br />
Diese konste muss einen INT wert haben.<br />
Dieser wert ist irgendwo in einer DLL gespeichert, im zusammenhang mit der quelle steht da. Ich möchte das jetzt aber ohne die dll machen... Leider weiß ich nicht wo ich die quelle hinterlegen muss.</p>
<p>Vllt kann mir da ja wer weiter helfen.</p>
<p>Hier mal der meiner meinung nach wictige codeabschnitt:</p>
<pre><code class="language-cpp">case WM_PAINT:
    {
        BITMAP bm;
        PAINTSTRUCT ps;

        HDC hdc = BeginPaint(hWnd, &amp;ps);

        HDC hdcMem = CreateCompatibleDC(hdc);
        HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmball);

        GetObject(g_hbmball, sizeof(bm), &amp;bm);

        BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

        SelectObject(hdcMem, hbmOld);
        DeleteDC(hdcMem);

        EndPaint(hWnd, &amp;ps);
    }
    break;
</code></pre>
<p>MFG Sqwan</p>
<p>Und dann noch mal den ganzen code, falls das helfen sollte...</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

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

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
{
   MSG          msg;
   HWND         hWnd;
   WNDCLASS     wc;

   char szAppName[] = &quot;Tastaturabfragen&quot;;

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

   RegisterClass(&amp;wc);

   hWnd = CreateWindow( szAppName,
                        szAppName,
                        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)
{

   static RECT   rect;
   static bool   ArrowKeys[4];
   HBITMAP g_hbmball = NULL;
   const IDB_BALL=0;

   switch (message)
   {

   case WM_CREATE:
	   {
		   g_hbmball=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BALL));
		   if(g_hbmball==NULL)
			   MessageBox(hWnd, &quot;Could not load IDB_Ball!&quot;, &quot;ERROR&quot;, MB_OK | MB_ICONEXCLAMATION);
		   break;
	   }
   case WM_SIZE:
      {
         rect.right  = LOWORD(lParam);
         rect.bottom = HIWORD(lParam);
         return 0;
      }

   case WM_KEYDOWN:
      {

         switch (wParam)
         {
         case VK_LEFT:

            ArrowKeys[0] = true;
            break;

         case VK_UP:
            ArrowKeys[1] = true;
            break;

         case VK_RIGHT:
            ArrowKeys[2] = true;
            break;

         case VK_DOWN:
            ArrowKeys[3] = true;
            break;

         default:
            return 0;
         }
         InvalidateRect(hWnd, NULL, FALSE);
         return 0;
      }

      case WM_KEYUP:
      {
         switch (wParam)
         {
         case VK_LEFT:
            ArrowKeys[0] = false;
            break;

         case VK_UP:
            ArrowKeys[1] = false;
            break;

         case VK_RIGHT:
            ArrowKeys[2] = false;
            break;

         case VK_DOWN:
            ArrowKeys[3] = false;
            break;

         default:
            return 0;
         }
         InvalidateRect(hWnd, NULL, FALSE);
         return 0;
      }
case WM_PAINT:
    {
        BITMAP bm;
        PAINTSTRUCT ps;

        HDC hdc = BeginPaint(hWnd, &amp;ps);

        HDC hdcMem = CreateCompatibleDC(hdc);
        HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmball);

        GetObject(g_hbmball, sizeof(bm), &amp;bm);

        BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

        SelectObject(hdcMem, hbmOld);
        DeleteDC(hdcMem);

        EndPaint(hWnd, &amp;ps);
    }
    break;
   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }
   }
   return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/182607/bild-ohne-dll-laden</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 12:42:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/182607.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 May 2007 10:25:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bild ohne DLL laden on Sun, 27 May 2007 10:25:23 GMT]]></title><description><![CDATA[<p>Also ich habe ein Proramm in dem ich ein Bild einbinden möchte.<br />
Dafür habe ich mir nun Informationen in Google gesucht und dem entsprechend einen Quellcode erstellt den ich ganz am ende mal poste.</p>
<p>Jedenfalls wird dort eine Konstante IDB_BALL verwendet.<br />
Diese konste muss einen INT wert haben.<br />
Dieser wert ist irgendwo in einer DLL gespeichert, im zusammenhang mit der quelle steht da. Ich möchte das jetzt aber ohne die dll machen... Leider weiß ich nicht wo ich die quelle hinterlegen muss.</p>
<p>Vllt kann mir da ja wer weiter helfen.</p>
<p>Hier mal der meiner meinung nach wictige codeabschnitt:</p>
<pre><code class="language-cpp">case WM_PAINT:
    {
        BITMAP bm;
        PAINTSTRUCT ps;

        HDC hdc = BeginPaint(hWnd, &amp;ps);

        HDC hdcMem = CreateCompatibleDC(hdc);
        HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmball);

        GetObject(g_hbmball, sizeof(bm), &amp;bm);

        BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

        SelectObject(hdcMem, hbmOld);
        DeleteDC(hdcMem);

        EndPaint(hWnd, &amp;ps);
    }
    break;
</code></pre>
<p>MFG Sqwan</p>
<p>Und dann noch mal den ganzen code, falls das helfen sollte...</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

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

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
{
   MSG          msg;
   HWND         hWnd;
   WNDCLASS     wc;

   char szAppName[] = &quot;Tastaturabfragen&quot;;

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

   RegisterClass(&amp;wc);

   hWnd = CreateWindow( szAppName,
                        szAppName,
                        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)
{

   static RECT   rect;
   static bool   ArrowKeys[4];
   HBITMAP g_hbmball = NULL;
   const IDB_BALL=0;

   switch (message)
   {

   case WM_CREATE:
	   {
		   g_hbmball=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BALL));
		   if(g_hbmball==NULL)
			   MessageBox(hWnd, &quot;Could not load IDB_Ball!&quot;, &quot;ERROR&quot;, MB_OK | MB_ICONEXCLAMATION);
		   break;
	   }
   case WM_SIZE:
      {
         rect.right  = LOWORD(lParam);
         rect.bottom = HIWORD(lParam);
         return 0;
      }

   case WM_KEYDOWN:
      {

         switch (wParam)
         {
         case VK_LEFT:

            ArrowKeys[0] = true;
            break;

         case VK_UP:
            ArrowKeys[1] = true;
            break;

         case VK_RIGHT:
            ArrowKeys[2] = true;
            break;

         case VK_DOWN:
            ArrowKeys[3] = true;
            break;

         default:
            return 0;
         }
         InvalidateRect(hWnd, NULL, FALSE);
         return 0;
      }

      case WM_KEYUP:
      {
         switch (wParam)
         {
         case VK_LEFT:
            ArrowKeys[0] = false;
            break;

         case VK_UP:
            ArrowKeys[1] = false;
            break;

         case VK_RIGHT:
            ArrowKeys[2] = false;
            break;

         case VK_DOWN:
            ArrowKeys[3] = false;
            break;

         default:
            return 0;
         }
         InvalidateRect(hWnd, NULL, FALSE);
         return 0;
      }
case WM_PAINT:
    {
        BITMAP bm;
        PAINTSTRUCT ps;

        HDC hdc = BeginPaint(hWnd, &amp;ps);

        HDC hdcMem = CreateCompatibleDC(hdc);
        HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmball);

        GetObject(g_hbmball, sizeof(bm), &amp;bm);

        BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

        SelectObject(hdcMem, hbmOld);
        DeleteDC(hdcMem);

        EndPaint(hWnd, &amp;ps);
    }
    break;
   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }
   }
   return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1293009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293009</guid><dc:creator><![CDATA[Sqwan]]></dc:creator><pubDate>Sun, 27 May 2007 10:25:23 GMT</pubDate></item><item><title><![CDATA[Reply to Bild ohne DLL laden on Sun, 27 May 2007 16:29:26 GMT]]></title><description><![CDATA[<p>Ich hoffe mal du suchst sowas:<br />
<a href="http://www.winprog.org/tutorial/resources.html" rel="nofollow">http://www.winprog.org/tutorial/resources.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293197</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 27 May 2007 16:29:26 GMT</pubDate></item></channel></rss>