The following example waits for an event notification from the Error Logging service. The call will wait indefinitely for an event notification.

   #define INCL_LOGGING
   #include <unichar.h>
   #include <os2.h>
   #include <stdio.h>
           .
           .
           .
{
   APIRET rc;              /* return code */
   ULONG service;
   LWEREQUEST log_wait_event_packet;
   HLOGNOTIFY  log_notify;
   EVENTKEY EventKey;
   BYTE  log_entry_buffer[4096];
   UniChar pathname[512];
   ULONG pathname_length = sizeof(pathname);


   service =  ERROR_LOGGING_SERVICE;

   /*   Construct the LogChangeEventFilter parameter packet  */
   log_wait_event_packet.packet_size = sizeof(LWEREQUEST);
   log_wait_event_packet.packet_revision_number = WPOS_RELEASE_1;
   log_wait_event_packet.LogNotify = log_notify;
   log_wait_event_packet.pEventKey  = &EventKey;
   log_wait_event_packet.pLogEntryBuffer = &log_entry_buffer;
   log_wait_event_packet.timeout = 0;
   log_wait_event_packet.queue_flags = 0;
   log_wait_event_packet.pathname_length = &pathname_length;
   log_wait_event_packet.pathname = pathname;

   rc = LogWaitEvent(service,                      /* service */
                    &log_wait_event_packet)        /* parameter packet */
   if (rc != 0)
      {
         printf("LogWaitEvent error: return code = %d",rc);
         return;
      }


[Back: LogWaitEvent - Related Functions]
[Next: LogWaitEvent - Topics]