10-17-2014, 04:00 PM
Hi -
I'm trying to listen in QM for events from a Dictaphone PowerMicII-NS microphone. This microphone has several buttons on it and I'd like to capture events on a subset of the buttons. I have a working C# program that can read the events but I don't know the best way to hook this into QM.
If I create the event like this:
Function PowerScribeListener
In another function I can set the LEDs on the microphone to various colors and through Console.WriteLine() statements in C# it appears that everything is working. In general - all synchronous commands appear to be working from the IDispatch object.
However - with async callbacks I'm stumped. Keeping a reference to the IDispatch object in QM does not appear to keep the callbacks working. So - I launched a separate thread in C#:
where ThreadProc does the initialization. If I do this - the callbacks from button presses appear in the console. The good part is that this appears to work; the bad part is that it feels awkward and that there is probably a much cleaner way to do this. The thread needs to run for hours in a clinical application so I want this to be solid.
Thanks for any advice.
I'm trying to listen in QM for events from a Dictaphone PowerMicII-NS microphone. This microphone has several buttons on it and I'd like to capture events on a subset of the buttons. I have a working C# program that can read the events but I don't know the best way to hook this into QM.
If I create the event like this:
Function PowerScribeListener
#opt nowarnings 1 ;;disable warning "Most COM objects cannot be global"
IDispatch+ ps360MicrophoneListener
#opt nowarnings 0
In another function I can set the LEDs on the microphone to various colors and through Console.WriteLine() statements in C# it appears that everything is working. In general - all synchronous commands appear to be working from the IDispatch object.
However - with async callbacks I'm stumped. Keeping a reference to the IDispatch object in QM does not appear to keep the callbacks working. So - I launched a separate thread in C#:
public int aSyncInitMicrophone(int msec)
{
Thread t = new Thread(new ThreadStart(ThreadProc));
continueLoop = 1;
t.Start();
t.Join();
return 0;
}
Thanks for any advice.