home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1498 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.6 KB  |  46 lines

  1. Path: sparky!uunet!olivea!hal.com!decwrl!deccrl!bloom-beacon!eru.mt.luth.se!lunic!sunic!news.funet.fi!uta!jere
  2. From: jere@uta.fi (Jere K{pyaho)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Weird problem with MMAPI and STRICT
  5. Message-ID: <6447@kielouta.fi>
  6. Date: 26 Aug 92 06:27:49 GMT
  7. Organization: University of Tampere, Finland
  8. Lines: 36
  9.  
  10. Can anyone figure out what is happening here:
  11.  
  12. This is Win3.1, Borland C++ 3.1. I have the following, very
  13. simple piece of code, written in straight C, which uses the
  14. Windows 3.1 Multimedia API:
  15.  
  16. #include <windows.h>
  17. #include <mmsystem.h>
  18. ...
  19. HMIDIOUT hMidiOut;    /* handle to MIDI output device */
  20. UINT uiMidiOut;        /* MIDI output device ID */
  21. int iReturn;        /* call return value */
  22.  
  23. iReturn = midiOutOpen( (LPHMIDIOUT) &hMidiOut, uiMidiOut,
  24.             (DWORD) hwnd, 0L, CALLBACK_WINDOW );
  25.  
  26. Here, uiMidiOut has been initialized to a valid MIDI device ID -
  27. this I checked. The hwnd is just a window handle -- I don't
  28. think it makes any difference even if it is actually a dialog:
  29. a window is a window, right? So I could direct the MIDI messages
  30. to a scrollbar if I felt like it. ;-)
  31.  
  32. Anyway, what happens is that when I compile this stuff with
  33. WIN31 and STRICT, the midiOutOpen() call bombs, giving me
  34. an Error 11: Invalid parameter passed to a system function.
  35. The funny thing is that when I compile it _without_ STRICT,
  36. the call works OK.
  37.  
  38. So what's the invalid parameter? The obvious workaround is
  39. to compile without STRICT, but then you lose many other
  40. nice checks for stupid errors.
  41.  
  42. Jere
  43. -- 
  44. /* Jere K{pyaho -- jere@kielo.uta.fi -- University of Tampere, Finland */
  45. /* Department of Translation Studies -- Department of Computer Science */
  46.