This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problems with Petzold programs


Ben McGunigle[SMTP:ben@bcgrizzly.com] wrote:
>I am learning Win95 programming using the Petzold book and the
>minimalist compiler. I have had trouble with the PlaySound() function
>and the SND_* defines being nonexistent (Example program hellowin.c). 
>The SM_RESERVED1 - 4 defines (sysmets.h) are likewise absent from the
>header files. I assume they are present by default in the MS compiler
>recommended by the book

As for the mmsystem.h stuff, it is, as far as I know, completely missing
from the current GNU Win32 API include files. Here is a short replacement
which contains only enough to get that particular Petzold example to
compile:

/*
 * Temporary mmsystem.h because GNU-Win32 doesn't have one yet.
 */

#ifndef _MMSYSTEM_H_
#define _MMSYSTEM_H_

#ifdef	__cplusplus
extern "C" {
#endif

/* Flags for PlaySound */
#define SND_SYNC        0x00000000
#define SND_ASYNC       0x00000001
#define SND_NODEFAULT   0x00000002
#define SND_MEMORY      0x00000004
#define SND_LOOP        0x00000008
#define SND_NOSTOP      0x00000010
#define SND_PURGE       0x00000040
#define SND_APPLICATION 0x00000080
#define SND_NOWAIT      0x00002000
#define SND_ALIAS       0x00010000
#define SND_FILENAME    0x00020000
#define SND_RESOURCE    0x00040004
#define SND_ALIAS_ID    0x00110000

BOOL WINAPI PlaySoundA (LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
BOOL WINAPI PlaySoundW (LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);

#ifdef UNICODE
#define PlaySound PlaySoundW
#else
#define PlaySound PlaySoundA
#endif

#ifdef __cplusplus
}
#endif

#endif /* Not defined _MMSYSTEM_H_ */

The defintions of SM_RESERVED1 - 4 are also not included (probably since
nobody would ever use them normally) but here they are so that you
can add them to Defines.h:

#define SM_RESERVED1 (24)
#define SM_RESERVED2 (25)
#define SM_RESERVED3 (26)
#define SM_RESERVED4 (27)

I don't know if Scott Christley is the maintainer of the GNU Win32 API
header files, but his name and email address are at the top of them,
so he might be someone to talk to about fixing bugs and ommissions.
 
Good luck,
Colin.

-- Colin Peters - Saga Univ. Dept. of Information Science
-- colin@bird.fu.is.saga-u.ac.jp - finger for PGP public key
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]