From: dee.earley@icode.co.uk   
      
   On 03/12/2009 16:00, Michael P wrote:   
   > "Dee Earley" wrote in message   
   > news:4b17d45b$0$350$7b0f0fd3@reader.news.newnet.co.uk...   
   >> On 03/12/2009 14:52, Michael P wrote:   
   >>> As I said it may be because MidiIN_Proc is called by an external event.   
   >>> So if it's just not possible, I would very much appreciate an idea   
   >>> for a workaround.   
   >>   
   >> Have you tried without the subclassing?   
   >> I assume that midiin_proc is a message handler and that you clean it up   
   >> properly when you've finished?   
   >   
   > I don't think it can be done without subclassing.   
   > It works like this. In my Form1 Activate event I make this call   
   > to open the midi port:   
   > (I make sure the code is only executed once even if the event fires again)   
   >   
   > midiError = midiInOpen(hMidiIN, mMPU401IN, AddressOf MidiIN_Proc, 0,   
   > CALLBACK_FUNCTION)   
   >   
   > and in my Form1 Terminate event I close it again:   
   >   
   > midiError = midiInClose(hMidiIN)   
   >   
   > midiInOpen and midiInClose are declared in the module:   
   >   
   > Declare Function midiInOpen Lib "winmm.dll" (lphMidiIn As Long, ByVal   
   > uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal   
   > dwFlags As Long) As Long   
   > Declare Function midiInClose Lib "winmm.dll" (ByVal hMidiIN As Long) As Long   
      
   Have you seen the notes in MSDN for MidiInProc?   
   Specifically, the very limited set of functions you can reliably call   
   from inside it.   
   Showing a modal windows is definitely out of the question.   
      
   The easiest way is to use a timer, disabled by default with a 1ms   
   interval that you enable when you get the write message.   
   In the timer, you disable itself, then show your form.   
      
   --   
   Dee Earley (dee.earley@icode.co.uk)   
   i-Catcher Development Team   
      
   iCode Systems   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|