
Description | Cautions | Example | See Also
Name: |
long sr_NotifyEvent(handle, message, flags) | |
Inputs: |
HWND handle |
|
|
unsigned int message |
|
|
unsigned int flags |
|
Returns: |
0 if success -1 if failure |
|
Includes: |
srllib.h |
|
Type: |
Event handling | |
The sr_NotifyEvent( ) function informs the SRL to send event notification to a window. This provides a method of getting notification of Dialogic events through the Window's event queue. Although the actual event does not come in through the Window's event queue, a notification message is sent which, when received, causes the application to call the sr_waitevt( ) function with a 0 timeout to pull an event from the Dialogic event queue.
Parameter |
Description | |
handle |
Window handle to which the message is to be sent | |
message |
number of the message (message ID) | |
flag |
flags to turn event notification on or off: | |
|
SR_NOTIFY_ON |
event notification on |
This function should be only used when doing an asynchronous application controlling all devices within one thread. The application must call sr_waitevt(0) to get the event off the Dialogic event queue.
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
#define WM_SRNOTIFYEVENT WM_USER + 100 /* user defined message for event notification */
long PASCAL FrameWndProc(HWND, UINT, UINT, LONG);
WNDCLASS wndclass;
har szFrameClass[] = "MdiFrame";
HWND hwndFrame;
main( ... )
{
int chdev;
.
.
.
/* Register window class */
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = FrameWndProc;
.
.
.
wndclass.lpszClassName = szFrameClass;
RegisterClass(&wndclass);
/* Create Frame window */
hwndFrame = CreateWindow(szFrameClass,
"Sample Dialogic Voice Application",
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
/* Turn on event notification as Window message */
sr_NotifyEvent(hwndFrame,WM_SRNOTIFYEVENT, SR_NOTIFY_ON);
.
.
.
if ((chdev = dx_open("dxxB1C1",0)) == -1) {
MyPrintf("Failed to open dxxB1C1\n");
exit(0);
}
if (dx_sethook(chdev,DX_ONHOOK,EV_ASYNC) == -1) {
MyPrintf("Failed to go offhook: %s\n",ATDV_ERRMSGP(chdev));
}
.
.
.
}
/************************************************************
* NAME: FrameWndProc()
* DESCRIPTION: Frame window procedure in an MDI application.
************************************************************/
long PASCAL FrameWndProc(HWND hwnd, UINT message,
UINT wParam, LONG lParam)
{
switch(message) {
case WM_CREATE:
.
.
.
case WM_COMMAND:
.
.
.
case WM_SRNOTIFYEVENT:
if (sr_waitevt(0) == -1) {
MyPrintf("sr_waitevt: %s",ATDV_ERRMSGP(SRL_DEVICE));
break;
}
switch( sr_getevttype()) {
case TDX_SETHOOK:
MyPrintf("Sethook complete\n");
break;
case TDX_PLAY:
case TDX_RECORD:
.
.
.
}
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
.
.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation