diff options
-rw-r--r-- | PC/winsound.c | 21 | ||||
-rw-r--r-- | PCbuild/winsound.dsp | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/PC/winsound.c b/PC/winsound.c index 21f1f01..bdc8b4c 100644 --- a/PC/winsound.c +++ b/PC/winsound.c @@ -56,6 +56,9 @@ PyDoc_STRVAR(sound_beep_doc, "code doing direct port manipulation is used; it's unknown whether that\n" "will work on all systems."); +PyDoc_STRVAR(sound_msgbeep_doc, +"MessageBeep(x) - call Windows MessageBeep(x). x defaults to MB_OK."); + PyDoc_STRVAR(sound_module_doc, "PlaySound(sound, flags) - play a sound\n" "SND_FILENAME - sound is a wav file name\n" @@ -173,10 +176,22 @@ sound_beep(PyObject *self, PyObject *args) return Py_None; } +static PyObject * +sound_msgbeep(PyObject *self, PyObject *args) +{ + int x = MB_OK; + if (!PyArg_ParseTuple(args, "|i:MessageBeep", &x)) + return NULL; + MessageBeep(x); + Py_INCREF(Py_None); + return Py_None; +} + static struct PyMethodDef sound_methods[] = { {"PlaySound", sound_playsound, METH_VARARGS, sound_playsound_doc}, {"Beep", sound_beep, METH_VARARGS, sound_beep_doc}, + {"MessageBeep", sound_msgbeep, METH_VARARGS, sound_msgbeep_doc}, {NULL, NULL} }; @@ -216,6 +231,12 @@ initwinsound(void) ADD_DEFINE(SND_LOOP); ADD_DEFINE(SND_APPLICATION); + ADD_DEFINE(MB_OK); + ADD_DEFINE(MB_ICONASTERISK); + ADD_DEFINE(MB_ICONEXCLAMATION); + ADD_DEFINE(MB_ICONHAND); + ADD_DEFINE(MB_ICONQUESTION); + version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&version); whichOS = Win9X; diff --git a/PCbuild/winsound.dsp b/PCbuild/winsound.dsp index 892a969..04a9e59 100644 --- a/PCbuild/winsound.dsp +++ b/PCbuild/winsound.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd"
+# ADD LINK32 kernel32.lib winmm.lib user32.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "winsound - Win32 Debug"
@@ -82,7 +82,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept
+# ADD LINK32 user32.lib kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
|