HP Remote Graphics 4.2.0 User's Guide
To properly use monitorEvents(...), the following strings must be defined in its call:
∙LPCTSTR eventServer: if string is defined as "\\\\yourservername", then the log is stored on a remote server - if the string is empty (NULL), then the log is stored locally (note that four backlashes compiles to two in a string constant).
∙LPCTSTR eventSource: the name of the target event generator, e.g., "rgreceiver"
The programming header file, RGSenderEvents.h, is located with the RGS Sender installed software at:
C:\Program
Sender\include\RGSenderEvents.h
A simple
#include <windows.h> |
| |
#include <stdio.h> |
| |
#include "RGSenderEvents.h" | // safe EVENTLOGRECORD size for now | |
#define | BUFFER_SIZE 1024 | |
#define | EVENT_SERVER NULL | // remote server = "\\\\nodename"; local = NULL |
#define EVENT_SRC "rgsender" // specifies specific event name source in
// HPRemote
BOOL processEvent(LPCTSTR eventServer, LPCTSTR eventSource, DWORD dwEventNum)
{
HANDLE h; EVENTLOGRECORD *pevlr; BYTE bBuffer[BUFFER_SIZE]; DWORD dwRead, dwNeeded; BOOL result;
//Open, read, close event log ===========================================
if ((h = OpenEventLog(eventServer, eventSource)) == NULL)
{
... report error status ...
return true;
}
//Set the pointer to our buffer. Strings and data will get appended
//to the EVENTLOGRECORD structure.
pevlr = (EVENTLOGRECORD *) &bBuffer;
// Read the event specified by dwEventNum
result = ReadEventLog(h, | // event log handle |
EVENTLOG_SEEK_READ | // start at specific event |
EVENTLOG_FORWARDS_READ, | // advance forward |
dwEventNum, | // record to read |
pevlr, | // pointer to buffer |
BUFFER_SIZE, | // size of buffer |
98