Archived

This topic is now archived and is closed to further replies.

WHAT's WRONG

This topic is 6017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[/source] //------ Include Files ------// #include #include #include #include #include #include #include "Fastfile.h" #include "stdafx.h" #define INITGUID #include #include "wave.h" #include "Main.h" #include "Ffent.h" //------ Window Class Information ------// static char szClass[] = "Arab Space"; static char szCaption[] = "ARAB SPACE"; //------ Global Interface Pointers ------// LPDIRECTDRAW7 lpDD=NULL; LPDIRECTDRAWSURFACE7 lpDDSPrimary=NULL; LPDIRECTDRAWSURFACE7 lpDDSBack=NULL; //------ Define Number of Sounds ------// #define NUMSOUNDS 1 //------ DirectSound Object and Buffers ------// //------Define number of images and set up list of file names ------// #define IMAGE_COUNT 5 char file_names[IMAGE_COUNT][256] = { "start.bmp,FFDATFILE", "load.bmp,FFDATFILE", "cerdit.bmp,FFDATFILE", "exit.bmp,FFDATFILE", }; //------ DirectDraw Surfaces for Image Storage ------// LPDIRECTDRAWSURFACE7 lpSlides[IMAGE_COUNT]; //------ current image displayed------// int cur_image=0; //------ Error Return String ------// const char *ErrStr=NULL; //------ Error Messages ------// const char Err_Reg_Class[] = "Error Registering Window Class"; const char Err_Create_Win[] = "Error Creating Window"; const char Err_DirectDrawCreate[] = "DirectDrawCreate FAILED"; const char Err_Coop[] = "SetCooperativeLevel FAILED"; const char Err_CreateSurf[] = "CreateSurface FAILED"; const char Err_GetBack[] = "Error Retrieving Back Buffer"; const char Err_LoadBMP[] = "Error Loading Image"; const char Err_DispMode[] = "Error Setting Display Mode"; const char Err_LoadImage[] = "Error Loading Image"; const char Err_DirectSoundCreate[] = "DirectSoundCreate FAILED"; const char Err_CreateBuff[] = "CreateBuffer FAILED"; const char Err_LoadWAV[] = "Error Loading Sound"; //------ Function to Load a Bitmap into a DirectDraw Surface ------// LPDIRECTDRAWSURFACE7 bitmap_surface(LPCTSTR file_name,RECT *dims=NULL) { HDC hdc; HBITMAP bit; LPDIRECTDRAWSURFACE7 surf=NULL; // load the bitmap bit=(HBITMAP) LoadImage(NULL,file_name,IMAGE_BITMAP,0,0, LR_DEFAULTSIZE|LR_LOADFROMFILE); if (!bit) // failed to load, return failure to caller return NULL; // get bitmap dimensions BITMAP bitmap; GetObject( bit, sizeof(BITMAP), &bitmap ); int surf_width=bitmap.bmWidth; int surf_height=bitmap.bmHeight; // create surface HRESULT ddrval; DDSURFACEDESC2 ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(DDSURFACEDESC2); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; ddsd.dwWidth = surf_width; ddsd.dwHeight = surf_height; // attempt to create surface ddrval=lpDD->CreateSurface(&ddsd,&surf,NULL); // created ok? if (ddrval!=DD_OK) { // no, release the bitmap and return failure to caller DeleteObject(bit); return NULL; } else { // yes, get a DC for the surface surf->GetDC(&hdc); // generate a compatible DC HDC bit_dc=CreateCompatibleDC(hdc); // blit the interface to the surface SelectObject(bit_dc,bit); BitBlt(hdc,0,0,surf_width,surf_height,bit_dc,0,0,SRCCOPY); // release the DCs surf->ReleaseDC(hdc); DeleteDC(bit_dc); // save the dimensions if rectangle pointer provided if (dims) { dims->left=0; dims->top=0; dims->right=surf_width; dims->bottom=surf_height; } } // clear bitmap DeleteObject(bit); // return pointer to caller return surf; } //------ Cleanup Function to Release Objects ------// #define SafeRelease(x) if (x) { x->Release(); x=NULL;} void Cleanup() { // release loaded image surfaces for (int i=0;i); // release DirectDraw interfaces SafeRelease(lpDDSPrimary); SafeRelease(lpDD); // display error if one thrown if (ErrStr) { MessageBox(NULL, ErrStr, szCaption, MB_OK); ErrStr=NULL; } } //------ Function to Draw a Slide ------// void draw_slide() { // make sure we have the current image, don't draw if we fail if (!lpSlides[cur_image]) { lpSlides[cur_image]=bitmap_surface(file_names[cur_image]); if (!lpSlides[cur_image]) return; } // draw the object to the screen lpDDSBack->BltFast(0,0,lpSlides[cur_image],NULL,DDBLTFAST_WAIT); // draw instructions for slide show HDC hdc; if (DD_OK==lpDDSBack->GetDC(&hdc)) { TextOut(hdc,320,400,"Arab Space Ver 0,1",18); SetTextColor(hdc,0x0000ffff); lpDDSBack->ReleaseDC(hdc); } // flip to the primary surface lpDDSPrimary->Flip(0,DDFLIP_WAIT); // make sure we have the next and previous image // this insures that our next selection is quickly // available, while we only need to load one image // when the program starts. int next_slide=(cur_image>=IMAGE_COUNT-1) ? 0 : cur_image+1; if (!lpSlides[next_slide]) lpSlides[next_slide]=bitmap_surface(file_names[next_slide]); int prev_slide=(cur_image<1) ? IMAGE_COUNT-1 : cur_image-1; if (!lpSlides[prev_slide]) lpSlides[prev_slide]=bitmap_surface(file_names[prev_slide]); } //------ Windows Message Handler ------// LRESULT CALLBACK WindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: Cleanup(); PostQuitMessage(0); break; case WM_KEYDOWN: switch (wParam) { case VK_UP: // Process the LEFT ARROW key. cur_image--; if (cur_image<0) cur_image=IMAGE_COUNT-1; draw_slide(); break; case VK_DOWN: // Process the RIGHT ARROW key. cur_image++; if (cur_image>IMAGE_COUNT-1) cur_image=0; draw_slide(); break; case VK_ESCAPE: // exit the program on escape DestroyWindow(hWnd); break; // Process other non-character keystrokes. default: break; } default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0L; } //------ Function to Initialize DirectDraw and the Application ------// static BOOL Init(HINSTANCE hInstance, int nCmdShow) { WNDCLASS wc; HRESULT ddrval; // Set up and register window class wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC) WindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof(DWORD); wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = szClass; if (!RegisterClass(&wc)) { ErrStr=Err_Reg_Class; return FALSE; } // Get dimensions of display int ScreenWidth = GetSystemMetrics(SM_CXSCREEN); int ScreenHeight = GetSystemMetrics(SM_CYSCREEN); // Create a window and display HWND hWnd; hWnd = CreateWindow(szClass, // class szCaption, // caption WS_VISIBLE|WS_POPUP, // style 0, // left 0, // top ScreenWidth, // width ScreenHeight, // height NULL, // parent window NULL, // menu hInstance, // instance NULL); // parms if (!hWnd) { ErrStr=Err_Create_Win; return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); // clear image pointers ZeroMemory(lpSlides,sizeof(lpSlides)); // Create the main DirectDraw object ddrval = DirectDrawCreateEx(NULL, (VOID **) &lpDD, IID_IDirectDraw7, NULL); if (ddrval != DD_OK) { ErrStr=Err_DirectDrawCreate; return FALSE; } // Set our cooperative level ddrval = lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); if (ddrval != DD_OK) { ErrStr=Err_Coop; return FALSE; } // Set the display mode ddrval = lpDD->SetDisplayMode( 640, 480, 16, 0, 0); if (ddrval !=DD_OK) { ErrStr=Err_DispMode; return FALSE; } // Create the primary surface with 1 back buffer DDSURFACEDESC2 ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); if (ddrval!=DD_OK) { ErrStr=Err_CreateSurf; return FALSE; } // Fetch back buffer interface DDSCAPS2 ddscaps; ZeroMemory(&ddscaps,sizeof(ddscaps)); ddscaps.dwCaps=DDSCAPS_BACKBUFFER; ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack); if (ddrval!=DD_OK) { ErrStr=Err_GetBack; return FALSE; } // load the first image and display it lpSlides[0]=bitmap_surface(file_names[0]); if (!lpSlides[0]) return FALSE; draw_slide(); // return success to caller return TRUE; } //------ Application Loop ------// int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // initialize the application, exit on failure if (!Init(hInstance, nCmdShow)) { Cleanup(); return FALSE; } // run till completed MSG msg; while (GetMessage(&msg,NULL,0,0)) { // dispatch the message TranslateMessage(&msg); DispatchMessage(&msg); } // exit returning final message return (msg.wParam); }
  

Edited by - ahmed saleh on June 21, 2001 9:50:47 AM  [/i]

Edited by - ahmed saleh on June 21, 2001 7:28:15 PM  

Share this post


Link to post
Share on other sites
[/source]
/*--------------------------------------------------------------------------*/
// ARAB SPACE
//
// By Ahmed Saleh Mohammed Tolba
//
// CopyRight(c) 2001

//
//
//
/*--------------------------------------------------------------------------*/

//------ Include Files ------//

#include "stdafx.h"
#define INITGUID
#include
#include
#include
#include
#include "wave.h"


//------ Window Class Information ------//

static char szClass[] = "Arab Space";
static char szCaption[] = "ARAB SPACE";

//------ Global Interface Pointers ------//

LPDIRECTDRAW7 lpDD=NULL;
LPDIRECTDRAWSURFACE7 lpDDSPrimary=NULL;
LPDIRECTDRAWSURFACE7 lpDDSBack=NULL;

//-------------------------------------------//

#define NUMSOUNDS 1

//---------------------------------------------
// DIRECT SOUND GOLBAL
LPDIRECTSOUND lpDS;
LPDIRECTSOUNDBUFFER lpDSBSounds[NUMSOUNDS];
LONG lSirenPan;
LONG lSirenPanInc;

//----------------------------------------------




//------Define number of images and set up list of file names ------//

#define IMAGE_COUNT 5

char file_names[IMAGE_COUNT][256] = { "start.bmp",
"load.bmp",
"save.bmp",
"cerdit.bmp",
"exit.bmp",
};




//------ DirectDraw Surfaces for Image Storage ------//

LPDIRECTDRAWSURFACE7 lpSlides[IMAGE_COUNT];

//------ current image displayed------//

int cur_image=0;

//------ Error Return String ------//

const char *ErrStr=NULL;

//------ Error Messages ------//

const char Err_Reg_Class[] = "Error Registering Window Class";
const char Err_Create_Win[] = "Error Creating Window";
const char Err_DirectDrawCreate[] = "DirectDrawCreate FAILED";
const char Err_Coop[] = "SetCooperativeLevel FAILED";
const char Err_CreateSurf[] = "CreateSurface FAILED";
const char Err_GetBack[] = "Error Retrieving Back Buffer";
const char Err_LoadBMP[] = "Error Loading Image";
const char Err_DispMode[] = "Error Setting Display Mode";
const char Err_LoadImage[] = "Error Loading Image";
const char Err_DirectSoundCreate[] = "DirectSoundCreate FAILED";
const char Err_CreateBuff[] = "CreateBuffer FAILED";
const char Err_LoadWAV[] = "Error Loading Sound";
const char Err_CoopSounds[] ="Set Coopertivel Level Failed";




//------ Function to Load a Bitmap into a DirectDraw Surface ------//

LPDIRECTDRAWSURFACE7 bitmap_surface(LPCTSTR file_name,RECT *dims=NULL)
{
HDC hdc;
HBITMAP bit;
LPDIRECTDRAWSURFACE7 surf=NULL;

// load the bitmap

bit=(HBITMAP) LoadImage(NULL,file_name,IMAGE_BITMAP,0,0,
LR_DEFAULTSIZE|LR_LOADFROMFILE);
if (!bit)

// failed to load, return failure to caller

return NULL;

// get bitmap dimensions

BITMAP bitmap;
GetObject( bit, sizeof(BITMAP), &bitmap );
int surf_width=bitmap.bmWidth;
int surf_height=bitmap.bmHeight;

// create surface

HRESULT ddrval;
DDSURFACEDESC2 ddsd;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof(DDSURFACEDESC2);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwWidth = surf_width;
ddsd.dwHeight = surf_height;

// attempt to create surface

ddrval=lpDD->CreateSurface(&ddsd,&surf,NULL);

// created ok?

if (ddrval!=DD_OK) {

// no, release the bitmap and return failure to caller

DeleteObject(bit);
return NULL;

} else {

// yes, get a DC for the surface

surf->GetDC(&hdc);

// generate a compatible DC

HDC bit_dc=CreateCompatibleDC(hdc);

// blit the interface to the surface

SelectObject(bit_dc,bit);
BitBlt(hdc,0,0,surf_width,surf_height,bit_dc,0,0,SRCCOPY);

// release the DCs

surf->ReleaseDC(hdc);
DeleteDC(bit_dc);

// save the dimensions if rectangle pointer provided

if (dims) {
dims->left=0;
dims->top=0;
dims->right=surf_width;
dims->bottom=surf_height;
}
}

// clear bitmap

DeleteObject(bit);

// return pointer to caller

return surf;
}

//------ Cleanup Function to Release Objects ------//

#define SafeRelease(x) if (x) { x->Release(); x=NULL;}

void Cleanup()
{
// release loaded image surfaces

for (int i=0;i SafeRelease(lpSlides);

// release DirectDraw interfaces

SafeRelease(lpDDSPrimary);
SafeRelease(lpDD);
SafeRelease(lpDS);
// display error if one thrown

if (ErrStr) {
MessageBox(NULL, ErrStr, szCaption, MB_OK);
ErrStr=NULL;
}
}





//------ Function to Draw a Slide ------//

void draw_slide()
{
// make sure we have the current image, don''t draw if we fail

if (!lpSlides[cur_image]) {
lpSlides[cur_image]=bitmap_surface(file_names[cur_image]);
if (!lpSlides[cur_image])
return;
}

// draw the object to the screen

lpDDSBack->BltFast(0,0,lpSlides[cur_image],NULL,DDBLTFAST_WAIT);


// draw instructions for slide show

HDC hdc;
if (DD_OK==lpDDSBack->GetDC(&hdc)) {
TextOut(hdc,320,400,"Arab Space Ver 0,1",18);
SetTextColor(hdc,0x0000ffff);
lpDDSBack->ReleaseDC(hdc);
}

// flip to the primary surface

lpDDSPrimary->Flip(0,DDFLIP_WAIT);

// make sure we have the next and previous image
// this insures that our next selection is quickly
// available, while we only need to load one image
// when the program starts.

int next_slide=(cur_image>=IMAGE_COUNT-1) ? 0 : cur_image+1;
if (!lpSlides[next_slide])
lpSlides[next_slide]=bitmap_surface(file_names[next_slide]);

int prev_slide=(cur_image<1) ? IMAGE_COUNT-1 : cur_image-1;
if (!lpSlides[prev_slide])
lpSlides[prev_slide]=bitmap_surface(file_names[prev_slide]);
}

//------ Windows Message Handler ------//

LRESULT CALLBACK
WindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{

case WM_DESTROY:
Cleanup();
PostQuitMessage(0);
break;

case WM_KEYDOWN:
switch (wParam)
{
case VK_UP:

// Process the LEFT ARROW key.

cur_image--;
if (cur_image<0)
cur_image=IMAGE_COUNT-1;
draw_slide();
break;

case VK_DOWN:

// Process the RIGHT ARROW key.

cur_image++;
if (cur_image>IMAGE_COUNT-1)
cur_image=0;
draw_slide();
break;

case VK_ESCAPE:

// exit the program on escape

DestroyWindow(hWnd);
break;

// Process other non-character keystrokes.

default:
break;
}

default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}




//------ Function to Initialize DirectDraw and the Application ------//

static BOOL Init(HINSTANCE hInstance, int nCmdShow)
{
WNDCLASS wc;
HRESULT ddrval;

// Set up and register window class

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof(DWORD);
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = szClass;
if (!RegisterClass(&wc)) {
ErrStr=Err_Reg_Class;
return FALSE;
}

// Get dimensions of display

int ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int ScreenHeight = GetSystemMetrics(SM_CYSCREEN);

// Create a window and display

HWND hWnd;

hWnd = CreateWindow(szClass, // class
szCaption, // caption
WS_VISIBLE|WS_POPUP, // style
0, // left
0, // top
ScreenWidth, // width
ScreenHeight, // height
NULL, // parent window
NULL, // menu
hInstance, // instance
NULL); // parms
if (!hWnd) {
ErrStr=Err_Create_Win;
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

// clear image pointers

ZeroMemory(lpSlides,sizeof(lpSlides));

// Create the main DirectDraw object

ddrval = DirectDrawCreateEx(NULL, (VOID **) &lpDD, IID_IDirectDraw7, NULL);
if (ddrval != DD_OK) {
ErrStr=Err_DirectDrawCreate;
return FALSE;
}

// Set our cooperative level

ddrval = lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if (ddrval != DD_OK) {
ErrStr=Err_Coop;
return FALSE;
}

// Set the display mode

ddrval = lpDD->SetDisplayMode( 640, 480, 16, 0, 0);
if (ddrval !=DD_OK) {
ErrStr=Err_DispMode;
return FALSE;
}

// Create the primary surface with 1 back buffer

DDSURFACEDESC2 ddsd;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}

// Fetch back buffer interface

DDSCAPS2 ddscaps;
ZeroMemory(&ddscaps,sizeof(ddscaps));
ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack);
if (ddrval!=DD_OK) {
ErrStr=Err_GetBack;
return FALSE;
}

// load the first image and display it

lpSlides[0]=bitmap_surface(file_names[0]);
if (!lpSlides[0])
return FALSE;
draw_slide();

// return success to caller

return TRUE;
}

if (DirectSoundCreate(NULL, &lpDS, NULL) != DS_OK)
{

return FALSE;
}

// Set the cooperation level for the DS object
if (lpDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY) != DS_OK)
{

return FALSE;
}

// Initialize the DS buffers
if (!load_sounds())
{
return FALSE;
}
BOOL load_sounds()
{
// Initialize waves
CWave waves[NUMSOUNDS];
waves[0].Create("Siren.wav");


// Initialize secondary DS buffers
for (int i = 0; i < NUMSOUNDS; i++) {
// Get the wave information
DWORD dwDataLen = waves[i].GetDataLen();
WAVEFORMATEX wfFormat;
waves[i].GetFormat(wfFormat);

// Setup the DS buffer description
DSBUFFERDESC dsbdDesc;
ZeroMemory(&dsbdDesc, sizeof(DSBUFFERDESC));
dsbdDesc.dwSize = sizeof(DSBUFFERDESC);
dsbdDesc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN |
DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC;
dsbdDesc.dwBufferBytes = dwDataLen;
dsbdDesc.lpwfxFormat = &wfFormat;

// Create the DS buffer
if (lpDS->CreateSoundBuffer(&dsbdDesc,
&lpDSBSounds[i], NULL) != DS_OK)
{
ErrStr = Err_CreateBuff;
return FALSE;
}

// Lock the DS buffer
BYTE* pDSBuffData;
if (lpDSBSounds[i]->Lock(0, dwDataLen, (void**)&pDSBuffData,
&dwDataLen, NULL, 0, 0) != DS_OK)
{
ErrStr = Err_LoadWAV;
return FALSE;
}

// Write wave data to the DS buffer
dwDataLen = waves[i].GetData(pDSBuffData, dwDataLen);

// Unlock the DS buffer
if (lpDSBSounds[i]->Unlock(pDSBuffData, dwDataLen, NULL, 0) !=
DS_OK)
{
ErrStr = Err_LoadWAV;
return FALSE;
}
}

return TRUE;
}









//------ Function to Restore DirectSound Buffers ------//

BOOL RestoreDSBuffers()
{
// Restore the buffers
for (int i = 0; i < NUMSOUNDS; i++)
if (lpDSBSounds[i]->Restore() != DS_OK)
return FALSE;

// Re-initialize the buffers
return load_sounds();
}
//------ Application Loop ------//

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// initialize the application, exit on failure

if (!Init(hInstance, nCmdShow)) {
Cleanup();
return FALSE;
}

// run till completed

MSG msg;
while (GetMessage(&msg,NULL,0,0)) {

// dispatch the message

TranslateMessage(&msg);
DispatchMessage(&msg);
}

// exit returning final message

return (msg.wParam);
}





THE MESSAGES IS
F:\arab\arab.cpp(432) : error C2143: syntax error : missing '';'' before ''if''
F:\arab\arab.cpp(433) : error C2143: syntax error : missing '';'' before ''{''
F:\arab\arab.cpp(433) : error C2447: missing function header (old-style formal list?)
F:\arab\arab.cpp(439) : error C2143: syntax error : missing '';'' before ''if''
F:\arab\arab.cpp(440) : error C2143: syntax error : missing '';'' before ''{''
F:\arab\arab.cpp(440) : error C2447: missing function header (old-style formal list?)
F:\arab\arab.cpp(446) : error C2143: syntax error : missing '';'' before ''if''
F:\arab\arab.cpp(447) : error C2143: syntax error : missing '';'' before ''{''
F:\arab\arab.cpp(447) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.

arab.exe - 9 error(s), 0 warning(s)

Share this post


Link to post
Share on other sites
Ahhhhh
I impress myself sometimes... lol

Here is your problem:

// load the first image and display it
lpSlides[0]=bitmap_surface(file_names[0]);
if (!lpSlides[0])
return FALSE;
draw_slide();

// return success to caller
return TRUE;
}

^^ right there you are ending your Init function. and then you run this code:

if ( DirectSoundCreate(NULL, &lpDS, NULL) != DS_OK )
{
return FALSE;
}

etc...

in no function at all... I think you want that to be in your Init function.. delete the ''return TRUE'''' and the ''}'' before the if (DirectSoundCreate.....) call...

Seeya
Krippy

Share this post


Link to post
Share on other sites