Charles,
The test code should really not work. You need both the resource type and the resource ID (or name).
This is the translated code for a bc9 example.
James
void PlayRcSound (HINSTANCE hInst, char* SndName)
{
HRSRC hr = {0};
HGLOBAL hg = {0};
LPVOID lpSndData = {0};
hr = FindResource( hInst, SndName, RT_RCDATA);
if(hr != 0 )
{
hg = LoadResource( hInst, hr);
if(hg != 0 )
{
lpSndData = LockResource( hg);
if(lpSndData != 0 )
{
PlaySound((LPCTSTR)lpSndData, 0, SND_MEMORY);
return;
}
}
}
}
LRESULT CALLBACK WndProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if(Msg == WM_COMMAND )
{
if(LOWORD(wParam) == ID_Button1 )
{
PlayRcSound(hInstance, MAKEINTRESOURCE(12345));
}
goto L1001;
}
if(Msg == WM_DESTROY )
{
PostQuitMessage(0);
return 0;
}
L1001:
;
return DefWindowProc(hWnd, Msg, wParam, lParam);
}