HP Remote Graphics Software 7.0
●
for a finite number of seconds (or infinite if seconds <= 0) do
●
open event log, read log length, close event log
●
if log has changed, processEvent(), else sleep for X ms.
To properly use the function monitorEvents(...), the following strings must be defined in the
function 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 sample agent uses Microsoft event logging functions such as OpenEventLog,
ReadEventLog, and CloseEventLog.
The sample agent is listed below. Where noted, user-specific code should be added. The agent
header file, RGSenderEvents.h, is installed with the RGS Sender and is located at:
C:\Program Files\Hewlett-Packard\Remote Graphics Sender\include
\RGSenderEvents.h
#include <windows.h>
#include <stdio.h>
#include "RGSenderEvents.h"
#define BUFFER_SIZE 1024 // safe EVENTLOGRECORD size for now
#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;
}
68 Chapter 8 Advanced RGS features