diff options
author | Guido van Rossum <guido@python.org> | 2003-04-09 19:38:08 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-09 19:38:08 (GMT) |
commit | e1252684be6097e1c5c7fa3b50c00355ccc7d476 (patch) | |
tree | 2e3f548dbde8094dca0716502d9f817de6b1d6d2 /PC/winsound.c | |
parent | ed538d8b39addebb182de0bc465206dd7e122d0c (diff) | |
download | cpython-e1252684be6097e1c5c7fa3b50c00355ccc7d476.zip cpython-e1252684be6097e1c5c7fa3b50c00355ccc7d476.tar.gz cpython-e1252684be6097e1c5c7fa3b50c00355ccc7d476.tar.bz2 |
Add MessageBeep() API.
Diffstat (limited to 'PC/winsound.c')
-rw-r--r-- | PC/winsound.c | 21 |
1 files changed, 21 insertions, 0 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; |