<?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[Dev-C++ | Bitmap als Background im Fenster]]></title><description><![CDATA[<p>Hi Leute,<br />
wie ihr schon im Titel des Threads lesen könnt hab ich ein Problem.<br />
Und zwar, möchte ich eine einfache Bitmap in miene Fenster darstellen. Dazu hab ich alles initialisiert und soweiter. Normalerweise würde man ja noch in der WM_CREATE-Anweisung den Button erstellen und mit SendMessage die Bitmap-Datei auf den Button platzieren. Entscheidend ist ja, das BS_BITMAP in der Stil angebe. Ich hab mir jetzt gedacht das ich einfach alles initialisiere und dann per SendMessage in der WM_CREATE das Bitmap einfach an die hWnd senden, damit das Programm weiss, das ich das eigentliche Fenster selber meine. Dies klappt aber nicht so richtig, deswegen hab ich versucht das Fenster nochmal abzufragen und bei der Abfrage das BS_BITMAP mit einzubinden und die SendMessage vorher zu definieren. Aber dies klappt auch nicht.<br />
Kann mir einer einen Tipp geben wie ich das besser honbekomme ?<br />
Hoffe meine Frage ist nicht zu kompliziert gestellt. Hier noch ein Teil des<br />
Codes (ist noch etwas unsauber und unübersichtlich, kommt aber noch) :</p>
<pre><code class="language-cpp">hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;www.gta-cu.de  by pivke&quot;,       /* Title Text */
           WS_EX_WINDOWEDGE | WS_EX_APPWINDOW | WS_VISIBLE | BS_BITMAP , /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           700,                 /* The programs width */
           500,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
        static HWND Button1;
        static HWND Button2;
        static HWND Button3;
        static HWND Button4;
        static HWND Button5;

   static HWND hButton;

bool buffer=FALSE;

   HDC                       hdc, hdcMem;
static HANDLE      hBitMap;
static BITMAP        bitmap ;
PAINTSTRUCT        ps ; 

   switch (message)
   {

   case WM_CREATE:
      {

                //Bild laden//
                  hBitMap=(HBITMAP)LoadImage(0,&quot;gta-background.bmp&quot;,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
                  GetObject (hBitMap, sizeof (BITMAP), &amp;bitmap) ;
                  //Fertig//
                  SendMessage (hWnd, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP,(LPARAM)(HANDLE) hBitMap);

                  char *buffer;
                  buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                  buffer=FALSE;

              Button1 = CreateWindow(  &quot;button&quot;,
                                  &quot;Beenden&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0, 0, 150, 25,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

            Button2 = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   buffer,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE |
                                              ES_AUTOVSCROLL,
                                   380, 30, 300, 300,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button3=CreateWindow(&quot;button&quot;,
                                   &quot;Handling.cfg öffnen&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   0,60,150,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button4=CreateWindow(&quot;button&quot;,
                                   &quot;GTA San Andreas starten&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   505,420,170,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                  if(!(Button2=CreateWindowEx(WS_EX_CLIENTEDGE,&quot;edit&quot;,buffer, WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,380, 30, 300, 300,  hWnd, NULL,((LPCREATESTRUCT) lParam) -&gt; hInstance, NULL)))
                                  {
                                                                                              MessageBox(NULL,&quot;Es ist ein Fehler aufgetreten, bitte schauen sie in der Konsole nach...&quot;,&quot;Error&quot;,MB_OK);
                                                              buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                                                                }

                                        else
                                        {
                                            buffer=&quot;*Edit-Control erfolgreich initialisiert...&quot;;
                                            }                

         return 0;
      }
</code></pre>
<p>Danke im Voraus !</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/206941/dev-c-bitmap-als-background-im-fenster</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 01:01:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206941.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Mar 2008 19:48:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sat, 01 Mar 2008 19:48:26 GMT]]></title><description><![CDATA[<p>Hi Leute,<br />
wie ihr schon im Titel des Threads lesen könnt hab ich ein Problem.<br />
Und zwar, möchte ich eine einfache Bitmap in miene Fenster darstellen. Dazu hab ich alles initialisiert und soweiter. Normalerweise würde man ja noch in der WM_CREATE-Anweisung den Button erstellen und mit SendMessage die Bitmap-Datei auf den Button platzieren. Entscheidend ist ja, das BS_BITMAP in der Stil angebe. Ich hab mir jetzt gedacht das ich einfach alles initialisiere und dann per SendMessage in der WM_CREATE das Bitmap einfach an die hWnd senden, damit das Programm weiss, das ich das eigentliche Fenster selber meine. Dies klappt aber nicht so richtig, deswegen hab ich versucht das Fenster nochmal abzufragen und bei der Abfrage das BS_BITMAP mit einzubinden und die SendMessage vorher zu definieren. Aber dies klappt auch nicht.<br />
Kann mir einer einen Tipp geben wie ich das besser honbekomme ?<br />
Hoffe meine Frage ist nicht zu kompliziert gestellt. Hier noch ein Teil des<br />
Codes (ist noch etwas unsauber und unübersichtlich, kommt aber noch) :</p>
<pre><code class="language-cpp">hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;www.gta-cu.de  by pivke&quot;,       /* Title Text */
           WS_EX_WINDOWEDGE | WS_EX_APPWINDOW | WS_VISIBLE | BS_BITMAP , /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           700,                 /* The programs width */
           500,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
        static HWND Button1;
        static HWND Button2;
        static HWND Button3;
        static HWND Button4;
        static HWND Button5;

   static HWND hButton;

bool buffer=FALSE;

   HDC                       hdc, hdcMem;
static HANDLE      hBitMap;
static BITMAP        bitmap ;
PAINTSTRUCT        ps ; 

   switch (message)
   {

   case WM_CREATE:
      {

                //Bild laden//
                  hBitMap=(HBITMAP)LoadImage(0,&quot;gta-background.bmp&quot;,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
                  GetObject (hBitMap, sizeof (BITMAP), &amp;bitmap) ;
                  //Fertig//
                  SendMessage (hWnd, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP,(LPARAM)(HANDLE) hBitMap);

                  char *buffer;
                  buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                  buffer=FALSE;

              Button1 = CreateWindow(  &quot;button&quot;,
                                  &quot;Beenden&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0, 0, 150, 25,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

            Button2 = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   buffer,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE |
                                              ES_AUTOVSCROLL,
                                   380, 30, 300, 300,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button3=CreateWindow(&quot;button&quot;,
                                   &quot;Handling.cfg öffnen&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   0,60,150,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button4=CreateWindow(&quot;button&quot;,
                                   &quot;GTA San Andreas starten&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   505,420,170,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                  if(!(Button2=CreateWindowEx(WS_EX_CLIENTEDGE,&quot;edit&quot;,buffer, WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,380, 30, 300, 300,  hWnd, NULL,((LPCREATESTRUCT) lParam) -&gt; hInstance, NULL)))
                                  {
                                                                                              MessageBox(NULL,&quot;Es ist ein Fehler aufgetreten, bitte schauen sie in der Konsole nach...&quot;,&quot;Error&quot;,MB_OK);
                                                              buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                                                                }

                                        else
                                        {
                                            buffer=&quot;*Edit-Control erfolgreich initialisiert...&quot;;
                                            }                

         return 0;
      }
</code></pre>
<p>Danke im Voraus !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466298</guid><dc:creator><![CDATA[pivke]]></dc:creator><pubDate>Sat, 01 Mar 2008 19:48:26 GMT</pubDate></item><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sat, 01 Mar 2008 20:39:49 GMT]]></title><description><![CDATA[<p>BitBlt (), StretchBlt () und vor allem WM_PAINT</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466325</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466325</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Sat, 01 Mar 2008 20:39:49 GMT</pubDate></item><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sat, 01 Mar 2008 21:19:02 GMT]]></title><description><![CDATA[<p>pivke schrieb:</p>
<blockquote>
<p>Entscheidend ist ja, das BS_BITMAP in der Stil angebe.</p>
</blockquote>
<p>Leider nicht. BS_BITMAP bewirkt nur etwas bei einem BUTTON, aber <em>nichts</em> z.B. bei einem Hauptfenster.</p>
<p>Sollte allerdings BS_BITMAP etwas bei einem STATIC, LISTBOX, EDIT oder COMBOBOX bewirken, dann ist es nur ein &quot;Zufall&quot; :</p>
<pre><code class="language-cpp">// aus der winuser.h

#define BS_BITMAP           0x00000080L
#define SS_NOPREFIX         0x00000080L // Don't do &quot;&amp;&quot; character translation 
#define ES_AUTOHSCROLL      0x0080L
#define LBS_USETABSTOPS     0x0080L
#define CBS_OEMCONVERT      0x0080L
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1466346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466346</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 01 Mar 2008 21:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sun, 02 Mar 2008 08:32:43 GMT]]></title><description><![CDATA[<blockquote>
<p>BitBlt (), StretchBlt () und vor allem WM_PAINT</p>
</blockquote>
<p>Hab ich doch gemacht, dachte der Code währe uninteressant :</p>
<pre><code class="language-cpp">case WM_CREATE:
      {

                //Bild laden//
                  hBitMap=(HBITMAP)LoadImage(0,&quot;gta-background.bmp&quot;,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE|LR_CREATEDIBSECTION);
                  GetObject (hBitMap, sizeof (BITMAP), &amp;bitmap) ;
                  //Fertig//
                  SendMessage (hWnd, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP,(LPARAM)(HANDLE) hBitMap);

                  char *buffer;
                  buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                  buffer=FALSE;

              Button1 = CreateWindow(  &quot;button&quot;,
                                  &quot;Beenden&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0, 0, 150, 25,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

            Button2 = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   buffer,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE |
                                              ES_AUTOVSCROLL,
                                   380, 30, 300, 300,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button3=CreateWindow(&quot;button&quot;,
                                   &quot;Handling.cfg öffnen&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   0,60,150,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                   Button4=CreateWindow(&quot;button&quot;,
                                   &quot;GTA San Andreas starten&quot;,
                                   WS_CHILD | WS_VISIBLE,
                                   505,420,170,25,
                                   hWnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

                                  if(!(Button2=CreateWindowEx(WS_EX_CLIENTEDGE,&quot;edit&quot;,buffer, WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,380, 30, 300, 300,  hWnd, NULL,((LPCREATESTRUCT) lParam) -&gt; hInstance, NULL)))
                                  {
                                                                                              MessageBox(NULL,&quot;Es ist ein Fehler aufgetreten, bitte schauen sie in der Konsole nach...&quot;,&quot;Error&quot;,MB_OK);
                                                              buffer=&quot;*Konnte Edit-Control nicht initialisieren...&quot;;
                                                                }

                                        else
                                        {
                                            buffer=&quot;*Edit-Control erfolgreich initialisiert...&quot;;
                                            }                

         return 0;
      }

      case WM_COMMAND:
           {
                      if (lParam == (LPARAM)Button1)
         {
            if (HIWORD(wParam) == BN_CLICKED)
               SendMessage(hWnd, WM_CLOSE, 0, 0);
         }

         if(lParam==(LPARAM)Button4)
         {
                                    if(MessageBox(NULL,&quot;Möchten sie jetzt GTA San Andreas starten ?&quot;,&quot;GTA San Andreas Start ?&quot;,MB_YESNO | MB_ICONQUESTION)==IDYES)
                                    {
                                                                MessageBox(NULL,&quot;GTA San Andreas wird jetzt gestartet&quot;,&quot;GTA San Andreas Start...&quot;,MB_OK);

                                    system(&quot;gta_sa.exe&quot;);
                                    }
                                    else
                                    {
                                        MessageBox(NULL,&quot;GTA San Andreas wird nicht gestartet...&quot;,&quot;GTA San Andreas Abbruch...&quot;,MB_OK);
                                        }

                                        if(system(&quot;gta_sa.exe&quot;) != 0)
                                        {
                                                                MessageBox(NULL,&quot;Stellen sie sicher, das sich dieses Programm im GTA Verzeichnis befindet&quot;,&quot;Error&quot;,MB_OK);
                                                                }

                                    }

         return 0;
         }

           case WM_PAINT:
                {
                         PAINTSTRUCT ps;
                         HDC hDC;

                         hdcMem = CreateCompatibleDC (hdc);
                         SelectObject(hdcMem,hBitMap);
                         BitBlt (hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, 
                                    hdcMem, 0, 0, SRCCOPY) ;

                         const char Konsole[]=&quot;Konsolen- und Ausgabefenster:&quot;;
                         hDC=BeginPaint(hWnd,&amp;ps);
                         DeleteDC(hdcMem);

                         {

                                                 TextOut(hDC, 380, 10, Konsole, sizeof(Konsole) - 1);

                                                        }
         EndPaint(hWnd, &amp;ps);
         return 0;
         }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1466438</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466438</guid><dc:creator><![CDATA[pivke]]></dc:creator><pubDate>Sun, 02 Mar 2008 08:32:43 GMT</pubDate></item><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sun, 02 Mar 2008 09:59:09 GMT]]></title><description><![CDATA[<p>Hallo , ich habe gesehn das du mit DEV C++ arbeites , und ich das gleiche problem mal hatte - ich habe dann mal irgentwo folgendes gefunden!!!</p>
<p>OHNE RECSOURCE !!! <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>
<pre><code class="language-cpp">#include &lt;windows.h&gt; 

char* pcBmp = &quot;xyz.bmp&quot;; 
HINSTANCE hInst; 

LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); 

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
LPSTR lpCmdLine, int nCmdShow) 
{ 
WNDCLASSEX WndCls; 
static char szAppName[] = &quot;Proggingmanias Simple Bitmap Window&quot;; 
MSG Msg; 

hInst = hInstance; 
WndCls.cbSize = sizeof(WndCls); 
WndCls.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW; 
WndCls.lpfnWndProc = WindProcedure; 
WndCls.cbClsExtra = 0; 
WndCls.cbWndExtra = 0; 
WndCls.hInstance = hInst; 
WndCls.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
WndCls.hCursor = LoadCursor(NULL, IDC_ARROW); 
WndCls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 
WndCls.lpszMenuName = NULL; 
WndCls.lpszClassName = szAppName; 
WndCls.hIconSm = LoadIcon(hInstance, IDI_APPLICATION); 
RegisterClassEx(&amp;WndCls); 

CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, 
szAppName, 
&quot;Proggingmanias Simple Bitmap Window&quot;, 
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 
CW_USEDEFAULT, 
CW_USEDEFAULT, 
CW_USEDEFAULT, 
CW_USEDEFAULT, 
NULL, 
NULL, 
hInstance, 
NULL); 

while( GetMessage(&amp;Msg, NULL, 0, 0) ) 
{ 
TranslateMessage(&amp;Msg); 
DispatchMessage( &amp;Msg); 
} 

return (Msg.wParam); 
} 

LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg, 
WPARAM wParam, LPARAM lParam) 
{ 
HDC hDC, MemDC; 
PAINTSTRUCT Ps; 
HBITMAP hbmp; 
char buf[256]; 

RECT r; 
GetWindowRect( hWnd, &amp;r ); 

switch(Msg) 
{ 
case WM_DESTROY: 
PostQuitMessage(WM_QUIT); 
break; 
case WM_PAINT: 
hDC = BeginPaint(hWnd, &amp;Ps); 

hbmp = (HBITMAP)LoadImage(NULL, pcBmp, IMAGE_BITMAP, 0, 0, 
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE); 

if ( !hbmp ) 
{ 

MessageBox( hWnd, buf, &quot;Picture not found&quot;, MB_OK ); 
ExitProcess(1); 
} 

// Create a memory device compatible with the above DC variable 
MemDC = CreateCompatibleDC(hDC); 
// Select the new bitmap 
SelectObject(MemDC, hbmp); 

// Copy the bits from the memory DC into the current dc 
BitBlt(hDC, 0, 0, r.right, r.bottom, MemDC, 0, 0, SRCCOPY); 

// Restore the old bitmap 
DeleteDC(MemDC); 
DeleteObject(hbmp); 
EndPaint(hWnd, &amp;Ps); 
break; 

default: 
return DefWindowProc(hWnd, Msg, wParam, lParam); 
} 
return 0; 
}
</code></pre>
<p>einfach complieren und fun haben <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="😉"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466483</guid><dc:creator><![CDATA[pofix]]></dc:creator><pubDate>Sun, 02 Mar 2008 09:59:09 GMT</pubDate></item><item><title><![CDATA[Reply to Dev-C++ | Bitmap als Background im Fenster on Sun, 02 Mar 2008 11:12:18 GMT]]></title><description><![CDATA[<blockquote>
<p>Hab ich doch gemacht, dachte der Code währe uninteressant :</p>
</blockquote>
<p>hmm tut mir leid ich hatte meine glaskugel gerade nicht neben mir als ich das gepostet habe <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="😉"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>also, entweder du machst das so, wie es pofix gepostet hat oder wenn du deine variante im ansatz behalten möchtest, dann sollte das ungefähr so gehen. Jedenfalls ähneln sich beide Varianten sehr stark. Der einzige Unterschied besteht eben in welcher Message welcher Code ausgeführt wird.</p>
<pre><code class="language-cpp">LRESULT CALLBACK WndProc (HWND hMain, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC hDC;

	static HDC dcSkin;
	static HANDLE hSkinBmp;

	switch (message)
	{
		case WM_CREATE:
				hSkinBmp = (HBITMAP) LoadImage (0, &quot;gta-background.bmp&quot;,
                                                IMAGE_BITMAP,
                                                0, 0,
                                                LR_DEFAULTSIZE | LR_LOADFROMFILE | LR_CREATEDIBSECTION);

				dcSkin = CreateCompatibleDC (0);
				SelectObject (dcSkin, hSkinBmp);
		return 0;

		case WM_PAINT:
			hDC = BeginPaint (hMain, &amp;ps);
			    SetBkMode (hDC, TRANSPARENT);
				SetTextColor (hDC, RGB (0, 0, 0));
				BitBlt (hDC, 0, 0, 500, 400, dcSkin, 0, 0, SRCCOPY);
            EndPaint (hMain, &amp;ps);
		return 0;

		case WM_DESTROY:
			DeleteObject (hSkinBmp);

			PostQuitMessage (0);
		return 0;
	}

	return DefWindowProc (hMain, message, wParam, lParam);
}
</code></pre>
<p>vllt fällt dir dann auch dein Fehler auf <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>
<p>PS: dein code ist IMO schlecht zu lesen, wegen den Einrückungen etc. Vllt. liegts aber auch mehr oder weniger an den Code-Tags.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466514</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Sun, 02 Mar 2008 11:12:18 GMT</pubDate></item></channel></rss>