I want to make the program where you simply double click on the program and it automatically plays the sounds. I was able to get it to compile without any problems. But the program does not generate any sound. I want the sounds to basically to be built into the program. I know this is posiible, but it may take a little of trial and error to fiqure it out. Anyway here is my source code, resource script, and rc script.
Source Code:
Code:
// Include the following libraries.
#include <windows.h>
#include <mmsystem.h>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include "Resource.h"
#pragma resource "xx.res"
using namespace std;
// Program begins here ------------------------------------------------
LRESULT CALLBACK WndProc (HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
WNDCLASSEX wndclass;
wndclass.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_XWORDX));
HMODULE hmod;
hmod=GetModuleHandle("xx.rc");
PlaySound ((LPCSTR) IDW_BAD, hmod, SND_ASYNC | SND_RESOURCE);
PlaySound ((LPCSTR) IDW_BIGFART, hmod, SND_ASYNC | SND_RESOURCE);
PlaySound ((LPCSTR) IDW_BADDUCK, hmod, SND_ASYNC | SND_RESOURCE);
PlaySound ((LPCSTR) IDW_BUNNYFART, hmod, SND_ASYNC | SND_RESOURCE);
PlaySound( MAKEINTRESOURCE(IDW_BAD),
GetModuleHandle(0)/* MFC AfxGetInstanceHandle()*/,
SND_ASYNC |SND_RESOURCE);
return 0;
}
Resource.h
Code:
// 10 JUNE 2005
// This includes the resources.
// This has icon resources and sound resources
//---------------------------------------------------------------------
// Icons--
#define IDI_XWORDX 1000
// Sounds--
// Sounds are in WAV formart.
#define IDW_BAD 2000
#define IDW_BIGFART 2001
#define IDW_BADDUCK 2002
#define IDW_BUNNYFART 2003
//---------------------------------------------------------------------
RC Script
Code:
// 10 JUNE 2005
// Include the resource files.
//---------------------------------------------------------------------
#include "Resource.h"
//---------------------------------------------------------------------
// *Icon Files*
IDI_XWORDX ICON "XWordX.ico"
// *Sound Files*
IDW_BAD WAVE "Bad.wav"
IDW_BIGFART WAVE "BigFart.wav"
IDW_BADDUCK WAVE "BadDuck.wav"
IDW_BUNNYFART WAVE "BunnyFart.wav"
//---------------------------------------------------------------------