<?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[Warum funktioniert PlaySound() hier nicht?!]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem <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="😃"
    /><br />
Also meine *.cpp-Datei:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;mmsystem.h&quot;

HINSTANCE hInst;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); 
int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow) 
{ 
char szName[] = &quot;Fensterklasse&quot;; 
HBRUSH MyBrush = CreateSolidBrush(RGB(255,255,51)); 
WNDCLASS wc; 

wc.style         = CS_HREDRAW | CS_VREDRAW;   // CS = &quot;class style&quot; 
wc.lpfnWndProc   = WndProc; 
wc.cbClsExtra    = 0; 
wc.cbWndExtra    = 0; 
wc.hInstance     = hI; 
wc.hIcon         = LoadIcon (NULL, IDI_WINLOGO); 
wc.hCursor       = LoadCursor (NULL, IDC_ARROW); 
wc.hbrBackground = MyBrush; 
wc.lpszMenuName  = NULL; 
wc.lpszClassName = szName; 

RegisterClass (&amp;wc); 

HWND hwnd = CreateWindow (szName, &quot;Soundtest&quot;, WS_SYSMENU | WS_THICKFRAME,   
                          300, 230, 500, 200, NULL, NULL, hI, NULL); 

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

// Nachrichten-Schleife 
MSG msg; 
    while (GetMessage (&amp;msg, NULL, 0, 0)) 
    { 
        TranslateMessage (&amp;msg); 
        DispatchMessage (&amp;msg); 
    } 
return msg.wParam; 
} 

// Windows-Nachrichten-Prozedur 
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
HDC hdc; 
PAINTSTRUCT ps; 
HWND hwndButton1; 

switch (message) 
{ 
case WM_PAINT: 
    hdc = BeginPaint (hwnd, &amp;ps); 
        TextOut (hdc, 20, 20, &quot;Soundtest&quot;, 20); 
    EndPaint (hwnd, &amp;ps); 
    return 0; 

case WM_CREATE: 
      hwndButton1 = CreateWindow ( &quot;button&quot;, &quot;Abspielen&quot;, 
                                   WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
                                   150, 20, 100, 40, hwnd, (HMENU)1, 
                                   (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL); 
    return 0; 

case WM_COMMAND: 
    if(LOWORD(wParam) == 1) 
    { 
        PlaySound(&quot;sound1&quot;, hInst, SND_RESOURCE);   
    }   
    return 0; 

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

return DefWindowProc (hwnd, message, wParam, lParam); 
}
</code></pre>
<p>und meine *.rc-Datei:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt; 

sound1 WAVE &quot;C:\\Windows\\Media\\tada.wav&quot;
</code></pre>
<p>Das ganze gibt immer so eine blöde Meldung:</p>
<blockquote>
<p>burnin joint.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__PlaySoundA@12<br />
Release/burnin joint.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise<br />
Fehler beim Ausführen von link.exe.</p>
</blockquote>
<p>Kann mir jemand sagen woran dass liegt?<br />
Bin schon ca. 1 Monat dabei und kriege es nicht gebacken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>Grüße,<br />
Björn</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/101397/warum-funktioniert-playsound-hier-nicht</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 13:45:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/101397.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Feb 2005 20:25:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Warum funktioniert PlaySound() hier nicht?! on Tue, 15 Feb 2005 20:25:23 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem <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="😃"
    /><br />
Also meine *.cpp-Datei:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;mmsystem.h&quot;

HINSTANCE hInst;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); 
int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow) 
{ 
char szName[] = &quot;Fensterklasse&quot;; 
HBRUSH MyBrush = CreateSolidBrush(RGB(255,255,51)); 
WNDCLASS wc; 

wc.style         = CS_HREDRAW | CS_VREDRAW;   // CS = &quot;class style&quot; 
wc.lpfnWndProc   = WndProc; 
wc.cbClsExtra    = 0; 
wc.cbWndExtra    = 0; 
wc.hInstance     = hI; 
wc.hIcon         = LoadIcon (NULL, IDI_WINLOGO); 
wc.hCursor       = LoadCursor (NULL, IDC_ARROW); 
wc.hbrBackground = MyBrush; 
wc.lpszMenuName  = NULL; 
wc.lpszClassName = szName; 

RegisterClass (&amp;wc); 

HWND hwnd = CreateWindow (szName, &quot;Soundtest&quot;, WS_SYSMENU | WS_THICKFRAME,   
                          300, 230, 500, 200, NULL, NULL, hI, NULL); 

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

// Nachrichten-Schleife 
MSG msg; 
    while (GetMessage (&amp;msg, NULL, 0, 0)) 
    { 
        TranslateMessage (&amp;msg); 
        DispatchMessage (&amp;msg); 
    } 
return msg.wParam; 
} 

// Windows-Nachrichten-Prozedur 
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
HDC hdc; 
PAINTSTRUCT ps; 
HWND hwndButton1; 

switch (message) 
{ 
case WM_PAINT: 
    hdc = BeginPaint (hwnd, &amp;ps); 
        TextOut (hdc, 20, 20, &quot;Soundtest&quot;, 20); 
    EndPaint (hwnd, &amp;ps); 
    return 0; 

case WM_CREATE: 
      hwndButton1 = CreateWindow ( &quot;button&quot;, &quot;Abspielen&quot;, 
                                   WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
                                   150, 20, 100, 40, hwnd, (HMENU)1, 
                                   (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL); 
    return 0; 

case WM_COMMAND: 
    if(LOWORD(wParam) == 1) 
    { 
        PlaySound(&quot;sound1&quot;, hInst, SND_RESOURCE);   
    }   
    return 0; 

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

return DefWindowProc (hwnd, message, wParam, lParam); 
}
</code></pre>
<p>und meine *.rc-Datei:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt; 

sound1 WAVE &quot;C:\\Windows\\Media\\tada.wav&quot;
</code></pre>
<p>Das ganze gibt immer so eine blöde Meldung:</p>
<blockquote>
<p>burnin joint.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__PlaySoundA@12<br />
Release/burnin joint.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise<br />
Fehler beim Ausführen von link.exe.</p>
</blockquote>
<p>Kann mir jemand sagen woran dass liegt?<br />
Bin schon ca. 1 Monat dabei und kriege es nicht gebacken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>Grüße,<br />
Björn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/724345</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/724345</guid><dc:creator><![CDATA[friesenjung21]]></dc:creator><pubDate>Tue, 15 Feb 2005 20:25:23 GMT</pubDate></item><item><title><![CDATA[Reply to Warum funktioniert PlaySound() hier nicht?! on Tue, 15 Feb 2005 20:39:24 GMT]]></title><description><![CDATA[<p>Du musst noch die Library Winmm.lib dazu linken.<br />
Denn mit der Headerdatei &quot;mmsystem.h&quot; hast du nur die Funktionsköpfe, also die Beschreibung, wie man die Fnkt. aufrufen muss.<br />
Die Lib brauchst du, damit das Programm auch genau weiß, wass denn nun genau PlaySound macht.</p>
<p>Das Hinzufügen machst du in den Projekteinstellungen unter Linker/Zusätzliche Abhängigkeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/724363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/724363</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 15 Feb 2005 20:39:24 GMT</pubDate></item><item><title><![CDATA[Reply to Warum funktioniert PlaySound() hier nicht?! on Tue, 15 Feb 2005 20:43:22 GMT]]></title><description><![CDATA[<p>UFF - diese Kleinigkeiten immer....<br />
Geht jetzt - danke!<br />
Björn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/724369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/724369</guid><dc:creator><![CDATA[friesenjung21]]></dc:creator><pubDate>Tue, 15 Feb 2005 20:43:22 GMT</pubDate></item></channel></rss>