# ProcessViewerEvent

The ProcessViewerEvent function informs plugins about different internal viewer events.

    int WINAPI ProcessViewerEvent(
      int Event,
      void *Param
    );

### Parameters

Event
Event type.
Can be one of the following values (VIEWER_EVENTS enum):

Event | Description
--- | ---
VE_CLOSE | One of the internal viewers is closing. Plugins can use this event to free internal data structures. Note that several viewers can be active at the same time. Param points to an integer variable containing the ViewerID parameter of the viewer instance being closed. The ViewerID of the current viewer can be obtained earlier using the VCTL_GETINFO ViewerControl command. But the plugin should not call the ViewerControl function when processing this event, because the viewer is already closed. Return value must be 0.
VE_READ | A new file has just been loaded. Param = NULL. Return value must be 0.
VE_KILLFOCUS | Viewer has lost input focus. Param points to a variable containing the ViewerID value of the viewer instance that has lost focus. Return value must be 0.
VE_GOTFOCUS | Viewer has got input focus. Param points to a variable containing the ViewerID value of the viewer instance that has got focus. Return value must be 0.

Param
Points to data dependent on the event type.

### Return value

Return value depends on the event type.
Return 0 for unknown event types.

### Remarks

- VE_READ is called only once for each file.
See also:
ViewerControl