Related Links
Event Service

Overview

This service is provided through the PDK interface and allows callers to register for events which are signaled by Prepar3D. Event GUIDs are defined in the interface header. Currently supported events are:

See PdkPlugin for an example of registering for multiple events and messages.

Classes

struct  P3DParameter
 
class  IParameterListV400
 
class  ICallbackV400
 
class  IEventServiceV400
 

Class Documentation

§ P3D::P3DParameter

struct P3D::P3DParameter

Parameter values used for IParameterListV400

Class Members
UINT64 Value

§ P3D::IParameterListV400

class P3D::IParameterListV400

Parameter list interface used by ICallbackV400

Inherits IUnknown.

Inherited by ParameterList.

Private Member Functions

virtual IServiceProvider * GetServiceProvider () override
 
virtual P3DParameter GetParameter (UINT32 index) override
 
virtual UINT32 GetCount () override
 

Member Function Documentation

§ GetCount()

virtual UINT32 GetCount ( )
privatepure virtual

Get parameter count.

Parameters
indexparameter index;
Returns
number of parameters in the params list.

Implemented in ParameterList.

§ GetParameter()

virtual P3DParameter GetParameter ( UINT32  index)
privatepure virtual

Get P3DParameter by index.

Parameters
indexparameter index;
Returns
The parameter requested.

Implemented in ParameterList.

§ GetServiceProvider()

virtual IServiceProvider* GetServiceProvider ( )
privatepure virtual

Get service provider. Use QueryService to request services from it.

Returns
Currently all callbacks pass an IPdk pointer as the service provider, but some callbacks may provide callback-specific providers in the future.

Implemented in ParameterList.

§ P3D::ICallbackV400

class P3D::ICallbackV400

Callback interface which must be implemented to register for events.

Parameters
indexparameter index;
Returns
number of parameters in the params list.

Inherits IUnknown.

Inherited by P3dCallback, and PdkPlugin::P3dPluginCallback.

Private Member Functions

virtual void Invoke (IParameterListV400 *pParams) override
 

Member Function Documentation

§ Invoke()

virtual void Invoke ( IParameterListV400 pParams)
privatepure virtual

Called when the registered event is fired.

Parameters
pParamsCallback parameters interface pointer.

Implemented in PdkPlugin::MessageCallback, PdkPlugin::CustomRenderCallback, PdkPlugin::FrameCallback, PdkPlugin::OneHzCallback, PdkPlugin::P3dPluginCallback, and P3dCallback.

§ P3D::IEventServiceV400

class P3D::IEventServiceV400

Service used to register for Prepar3D event callbacks

Inherits IUnknown.

Private Member Functions

virtual HRESULT RegisterCallback (const GUID &eventID, ICallbackV400 *pCallback) override
 
virtual HRESULT UnregisterCallback (const GUID &eventID, ICallbackV400 *pCallback) override
 
virtual HRESULT SendMessageEvent (UINT32 messageID, PVOID messageParam) override
 

Member Function Documentation

§ RegisterCallback()

virtual HRESULT RegisterCallback ( const GUID &  eventID,
ICallbackV400 pCallback 
)
privatepure virtual

Register an event callback.

Parameters
eventIDGUID id of the event to register for
pCallbackCallback to register
Returns
S_OK if succeeded and E_FAIL if it failed.

§ SendMessageEvent()

virtual HRESULT SendMessageEvent ( UINT32  messageID,
PVOID  messageParam 
)
privatepure virtual

Send a message event.

Parameters
messageIDmessage ID
PVOIDmessage parameter

§ UnregisterCallback()

virtual HRESULT UnregisterCallback ( const GUID &  eventID,
ICallbackV400 pCallback 
)
privatepure virtual

Unregister an event callback.

Parameters
eventIDGUID id of the event to register for
pCallbackCallback to register
Returns
S_OK if succeeded and E_FAIL if it failed.

Macros

#define EVENT_MESSAGE_APPLICATION_STARTUP   0x0036
 Application is starting up. More...
 
#define EVENT_MESSAGE_APPLICATION_SHUTDOWN   0x0037
 Application is shutting down. More...
 
#define EVENT_MESSAGE_APPLICATION_RESTART   0x003a
 Application is being "restarted" by a second instance. More...
 
#define EVENT_MESSAGE_APPLICATION_ACTIVATED   0x003b
 Application just received WM_ACTIVATEAPP. More...
 
#define EVENT_MESSAGE_APPLICATION_DEACTIVATED   0x003c
 Application just received WM_ACTIVATEAPP. More...
 
#define EVENT_MESSAGE_MAIN_WINDOW_CHANGE   0x003d
 Application main window maximized, etc. More...
 
#define EVENT_MESSAGE_MENU_MODE_START   0x0040
 Main menu is getting ready to be displayed. More...
 
#define EVENT_MESSAGE_MENU_MODE_STOP   0x0041
 Main menu is done being displayed. More...
 
#define EVENT_MESSAGE_CONTEXT_MENU_MODE_START   0x0042
 Context menu is getting ready to be displayed. More...
 
#define EVENT_MESSAGE_CONTEXT_MENU_MODE_STOP   0x0043
 Context menu is done being displayed. More...
 
#define EVENT_MESSAGE_DIALOG_MODE_START   0x0044
 A dialogue is getting ready to be displayed. More...
 
#define EVENT_MESSAGE_DIALOG_MODE_STOP   0x0045
 A dialogue is done being displayed. More...
 
#define EVENT_MESSAGE_MEMORY_LOW   0x0046
 A malloc has failed, if you see this free up some memory. More...
 
#define EVENT_MESSAGE_DEVICE_RESET_COMPLETED   0x0181
 Rendering system finished remapping windows to devices. More...
 
#define EVENT_MESSAGE_MAIN_LOADING_STATE_CHANGE   0x0191
 On MainLoadingState change send new state. More...
 
#define EVENT_MESSAGE_LOADING_COMPLETE   0x0197
 Done loading. More...
 
#define EVENT_MESSAGE_APPLICATION_DLLS_LOADED   0x003e
 Application dlls and plugin dlls are done loading. More...
 
#define EVENT_MESSAGE_SIM_PAUSED   0x0038
 Simulation is paused. More...
 
#define EVENT_MESSAGE_SIM_UNPAUSED   0x0039
 Simulation is unpaused. More...
 
#define EVENT_MESSAGE_SIMCONNECT_SIMULATION_START   0x0022
 SimConnect has detected "simulating" has started. More...
 
#define EVENT_MESSAGE_SIMCONNECT_SIMULATION_STOP   0x0023
 SimConnect has detected "simulating" has stopped. More...
 
#define EVENT_MESSAGE_SCENARIO_LOADING   0x0027
 Sent at beginning of scenario load sequence. More...
 
#define EVENT_MESSAGE_SCENARIO_LOADED   0x0028
 Sent at end of scenario load sequence. More...
 
#define EVENT_MESSAGE_CURRENT_SCENARIO_CHANGED   0x002F
 Global current scenario changed. More...
 
#define EVENT_MESSAGE_SCENARIO_POST_LOADED   0x0030
 After scenario PostLoad is completed. More...
 
#define EVENT_MESSAGE_CRASH_START   0x0081
 The user's plane just started crash sequence. More...
 
#define EVENT_MESSAGE_CRASH_COMPLETE   0x0082
 The user plane crashed and the crash sequence is done. More...
 
#define EVENT_MESSAGE_TIMESEASON_CHANGED_10MIN   0x0110
 10 minute time change More...
 
#define EVENT_MESSAGE_TIMESEASON_CHANGED_1MIN   0x0112
 1 minute time change More...
 
#define EVENT_MESSAGE_TIMESEASON_CHANGED_BY_USER   0x0113
 User has changed the time via the time/season dialogue. More...
 
#define EVENT_MESSAGE_REQUESTED_SIM_RATE_CHANGED   0x011A
 Sends the new value of the sim speed. More...
 
#define EVENT_MESSAGE_WEATHER_CHANGED   0x0133
 If there's any change in the weather, this message will get sent. More...
 
#define EVENT_MESSAGE_WEATHER_MODE_CHANGED   0x0138
 Weather system mode (i.e. RWW, theme, custom) has been changed. More...
 
#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_START   0x240
 User vehicle is changing. More...
 
#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_CREATED   0x241
 New User Vehicle is created but hasn't been registered. More...
 
#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_FINISH   0x242
 User vehicle has finished changing. More...
 
#define EVENT_MESSAGE_SIM_FROZEN   0x270
 Sim frozen. More...
 
#define EVENT_MESSAGE_SIM_UNFROZEN   0x271
 Sim unfrozen. More...
 
#define EVENT_MESSAGE_AVATAR_ATTACH_CHANGED   0x280
 The user's avatar has either attached or detached. More...
 
#define EVENT_MESSAGE_DESTROY_WINDOW   0x0150
 Window is about to be destroyed. More...
 
#define EVENT_MESSAGE_CREATE_WINDOW   0x0151
 New window was created. More...
 
#define EVENT_MESSAGE_VIEW_ACTIVATE   0x0160
 Window activated. More...
 
#define EVENT_MESSAGE_VIEW_MODE_CHANGED   0x0161
 View changed on a window. More...
 
#define EVENT_MESSAGE_VIEW_CREATE   0x0163
 Window created. More...
 
#define EVENT_MESSAGE_VIEW_DESTROY   0x0164
 Window destroyed. More...
 
#define EVENT_MESSAGE_MULTIPLAYER_SERVER_STARTED   0x0192
 When the host has created the server. More...
 
#define EVENT_MESSAGE_MULTIPLAYER_CLIENT_STARTED   0x0193
 When a client has joined a session. More...
 
#define EVENT_MESSAGE_MULTIPLAYER_LAUNCHED   0x0194
 When the multiplayer session is launched. More...
 
#define EVENT_MESSAGE_MULTIPLAYER_SESSION_ENDED   0x0195
 When the multiplayer session is ended. More...
 
#define EVENT_MESSAGE_HMD_CONNECTED   0x01A3
 Sent when an HMD is connected. More...
 
#define EVENT_MESSAGE_HMD_DISCONNECTED   0x01A4
 Sent when an HMD is disconnected. More...
 
#define EVENT_MESSAGE_HMD_VIEW_OPENED   0x01A5
 Sent when an HMD view is turned on. More...
 
#define EVENT_MESSAGE_HMD_VIEW_CLOSED   0x01A6
 Sent when an HMD view is turned off. More...
 
#define EVENT_MESSAGE_HMD_VIEW_DISABLE   0x01A7
 Send to disable current HMD view and revert to previous. More...
 
#define EVENT_MESSAGE_PANEL_OPENED   0x0231
 Panel opened. More...
 
#define EVENT_MESSAGE_PANEL_CLOSED   0x0232
 Panel closed. More...
 
#define EVENT_MESSAGE_SIMDIRECTOR_ACTIVE   0x022D
 
#define EVENT_MESSAGE_SIMDIRECTOR_INACTIVE   0x022E
 
#define EVENT_MESSAGE_ENABLE_VR_ON_STARTUP   0x300
 
#define EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_BEGIN   0x310
 
#define EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_END   0x311
 
#define EVENT_MESSAGE_CIGI_SESSION_STARTED   0x0400
 
#define EVENT_MESSAGE_CIGI_SESSION_STOPPED   0x0401
 

Variables

REFIID IID_IParameterListV400 = __uuidof(IParameterListV400)
 
REFIID IID_ICallbackV400 = __uuidof(ICallbackV400)
 
REFIID IID_IEventServiceV400 = __uuidof(IEventServiceV400)
 
REFIID SID_EventService = __uuidof(IEventServiceV400)
 
GUID EVENTID_Frame
 Event that is signaled once per frame. More...
 
GUID EVENTID_1Hz
 This event is signaled once per frame. More...
 
GUID EVENTID_CustomObjectDraw
 
GUID EVENTID_Message
 

Macro Definition Documentation

§ EVENT_MESSAGE_APPLICATION_ACTIVATED

#define EVENT_MESSAGE_APPLICATION_ACTIVATED   0x003b

Application just received WM_ACTIVATEAPP.

§ EVENT_MESSAGE_APPLICATION_DEACTIVATED

#define EVENT_MESSAGE_APPLICATION_DEACTIVATED   0x003c

Application just received WM_ACTIVATEAPP.

§ EVENT_MESSAGE_APPLICATION_DLLS_LOADED

#define EVENT_MESSAGE_APPLICATION_DLLS_LOADED   0x003e

Application dlls and plugin dlls are done loading.

§ EVENT_MESSAGE_APPLICATION_RESTART

#define EVENT_MESSAGE_APPLICATION_RESTART   0x003a

Application is being "restarted" by a second instance.

§ EVENT_MESSAGE_APPLICATION_SHUTDOWN

#define EVENT_MESSAGE_APPLICATION_SHUTDOWN   0x0037

Application is shutting down.

§ EVENT_MESSAGE_APPLICATION_STARTUP

#define EVENT_MESSAGE_APPLICATION_STARTUP   0x0036

Application is starting up.

§ EVENT_MESSAGE_AVATAR_ATTACH_CHANGED

#define EVENT_MESSAGE_AVATAR_ATTACH_CHANGED   0x280

The user's avatar has either attached or detached.

§ EVENT_MESSAGE_CHANGE_USER_VEHICLE_CREATED

#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_CREATED   0x241

New User Vehicle is created but hasn't been registered.

§ EVENT_MESSAGE_CHANGE_USER_VEHICLE_FINISH

#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_FINISH   0x242

User vehicle has finished changing.

§ EVENT_MESSAGE_CHANGE_USER_VEHICLE_START

#define EVENT_MESSAGE_CHANGE_USER_VEHICLE_START   0x240

User vehicle is changing.

§ EVENT_MESSAGE_CIGI_SESSION_STARTED

#define EVENT_MESSAGE_CIGI_SESSION_STARTED   0x0400

§ EVENT_MESSAGE_CIGI_SESSION_STOPPED

#define EVENT_MESSAGE_CIGI_SESSION_STOPPED   0x0401

§ EVENT_MESSAGE_CONTEXT_MENU_MODE_START

#define EVENT_MESSAGE_CONTEXT_MENU_MODE_START   0x0042

Context menu is getting ready to be displayed.

§ EVENT_MESSAGE_CONTEXT_MENU_MODE_STOP

#define EVENT_MESSAGE_CONTEXT_MENU_MODE_STOP   0x0043

Context menu is done being displayed.

§ EVENT_MESSAGE_CRASH_COMPLETE

#define EVENT_MESSAGE_CRASH_COMPLETE   0x0082

The user plane crashed and the crash sequence is done.

§ EVENT_MESSAGE_CRASH_START

#define EVENT_MESSAGE_CRASH_START   0x0081

The user's plane just started crash sequence.

§ EVENT_MESSAGE_CREATE_WINDOW

#define EVENT_MESSAGE_CREATE_WINDOW   0x0151

New window was created.

§ EVENT_MESSAGE_CURRENT_SCENARIO_CHANGED

#define EVENT_MESSAGE_CURRENT_SCENARIO_CHANGED   0x002F

Global current scenario changed.

§ EVENT_MESSAGE_DESTROY_WINDOW

#define EVENT_MESSAGE_DESTROY_WINDOW   0x0150

Window is about to be destroyed.

§ EVENT_MESSAGE_DEVICE_RESET_COMPLETED

#define EVENT_MESSAGE_DEVICE_RESET_COMPLETED   0x0181

Rendering system finished remapping windows to devices.

§ EVENT_MESSAGE_DIALOG_MODE_START

#define EVENT_MESSAGE_DIALOG_MODE_START   0x0044

A dialogue is getting ready to be displayed.

§ EVENT_MESSAGE_DIALOG_MODE_STOP

#define EVENT_MESSAGE_DIALOG_MODE_STOP   0x0045

A dialogue is done being displayed.

§ EVENT_MESSAGE_ENABLE_VR_ON_STARTUP

#define EVENT_MESSAGE_ENABLE_VR_ON_STARTUP   0x300

§ EVENT_MESSAGE_HMD_CONNECTED

#define EVENT_MESSAGE_HMD_CONNECTED   0x01A3

Sent when an HMD is connected.

§ EVENT_MESSAGE_HMD_DISCONNECTED

#define EVENT_MESSAGE_HMD_DISCONNECTED   0x01A4

Sent when an HMD is disconnected.

§ EVENT_MESSAGE_HMD_VIEW_CLOSED

#define EVENT_MESSAGE_HMD_VIEW_CLOSED   0x01A6

Sent when an HMD view is turned off.

§ EVENT_MESSAGE_HMD_VIEW_DISABLE

#define EVENT_MESSAGE_HMD_VIEW_DISABLE   0x01A7

Send to disable current HMD view and revert to previous.

§ EVENT_MESSAGE_HMD_VIEW_OPENED

#define EVENT_MESSAGE_HMD_VIEW_OPENED   0x01A5

Sent when an HMD view is turned on.

§ EVENT_MESSAGE_LOADING_COMPLETE

#define EVENT_MESSAGE_LOADING_COMPLETE   0x0197

Done loading.

§ EVENT_MESSAGE_MAIN_LOADING_STATE_CHANGE

#define EVENT_MESSAGE_MAIN_LOADING_STATE_CHANGE   0x0191

On MainLoadingState change send new state.

§ EVENT_MESSAGE_MAIN_WINDOW_CHANGE

#define EVENT_MESSAGE_MAIN_WINDOW_CHANGE   0x003d

Application main window maximized, etc.

§ EVENT_MESSAGE_MEMORY_LOW

#define EVENT_MESSAGE_MEMORY_LOW   0x0046

A malloc has failed, if you see this free up some memory.

§ EVENT_MESSAGE_MENU_MODE_START

#define EVENT_MESSAGE_MENU_MODE_START   0x0040

Main menu is getting ready to be displayed.

§ EVENT_MESSAGE_MENU_MODE_STOP

#define EVENT_MESSAGE_MENU_MODE_STOP   0x0041

Main menu is done being displayed.

§ EVENT_MESSAGE_MULTIPLAYER_CLIENT_STARTED

#define EVENT_MESSAGE_MULTIPLAYER_CLIENT_STARTED   0x0193

When a client has joined a session.

§ EVENT_MESSAGE_MULTIPLAYER_LAUNCHED

#define EVENT_MESSAGE_MULTIPLAYER_LAUNCHED   0x0194

When the multiplayer session is launched.

§ EVENT_MESSAGE_MULTIPLAYER_SERVER_STARTED

#define EVENT_MESSAGE_MULTIPLAYER_SERVER_STARTED   0x0192

When the host has created the server.

§ EVENT_MESSAGE_MULTIPLAYER_SESSION_ENDED

#define EVENT_MESSAGE_MULTIPLAYER_SESSION_ENDED   0x0195

When the multiplayer session is ended.

§ EVENT_MESSAGE_PANEL_CLOSED

#define EVENT_MESSAGE_PANEL_CLOSED   0x0232

Panel closed.

§ EVENT_MESSAGE_PANEL_OPENED

#define EVENT_MESSAGE_PANEL_OPENED   0x0231

Panel opened.

§ EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_BEGIN

#define EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_BEGIN   0x310

§ EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_END

#define EVENT_MESSAGE_RENDERING_SYSTEM_PRESENT_END   0x311

§ EVENT_MESSAGE_REQUESTED_SIM_RATE_CHANGED

#define EVENT_MESSAGE_REQUESTED_SIM_RATE_CHANGED   0x011A

Sends the new value of the sim speed.

§ EVENT_MESSAGE_SCENARIO_LOADED

#define EVENT_MESSAGE_SCENARIO_LOADED   0x0028

Sent at end of scenario load sequence.

§ EVENT_MESSAGE_SCENARIO_LOADING

#define EVENT_MESSAGE_SCENARIO_LOADING   0x0027

Sent at beginning of scenario load sequence.

§ EVENT_MESSAGE_SCENARIO_POST_LOADED

#define EVENT_MESSAGE_SCENARIO_POST_LOADED   0x0030

After scenario PostLoad is completed.

§ EVENT_MESSAGE_SIM_FROZEN

#define EVENT_MESSAGE_SIM_FROZEN   0x270

Sim frozen.

§ EVENT_MESSAGE_SIM_PAUSED

#define EVENT_MESSAGE_SIM_PAUSED   0x0038

Simulation is paused.

§ EVENT_MESSAGE_SIM_UNFROZEN

#define EVENT_MESSAGE_SIM_UNFROZEN   0x271

Sim unfrozen.

§ EVENT_MESSAGE_SIM_UNPAUSED

#define EVENT_MESSAGE_SIM_UNPAUSED   0x0039

Simulation is unpaused.

§ EVENT_MESSAGE_SIMCONNECT_SIMULATION_START

#define EVENT_MESSAGE_SIMCONNECT_SIMULATION_START   0x0022

SimConnect has detected "simulating" has started.

§ EVENT_MESSAGE_SIMCONNECT_SIMULATION_STOP

#define EVENT_MESSAGE_SIMCONNECT_SIMULATION_STOP   0x0023

SimConnect has detected "simulating" has stopped.

§ EVENT_MESSAGE_SIMDIRECTOR_ACTIVE

#define EVENT_MESSAGE_SIMDIRECTOR_ACTIVE   0x022D

§ EVENT_MESSAGE_SIMDIRECTOR_INACTIVE

#define EVENT_MESSAGE_SIMDIRECTOR_INACTIVE   0x022E

§ EVENT_MESSAGE_TIMESEASON_CHANGED_10MIN

#define EVENT_MESSAGE_TIMESEASON_CHANGED_10MIN   0x0110

10 minute time change

§ EVENT_MESSAGE_TIMESEASON_CHANGED_1MIN

#define EVENT_MESSAGE_TIMESEASON_CHANGED_1MIN   0x0112

1 minute time change

§ EVENT_MESSAGE_TIMESEASON_CHANGED_BY_USER

#define EVENT_MESSAGE_TIMESEASON_CHANGED_BY_USER   0x0113

User has changed the time via the time/season dialogue.

§ EVENT_MESSAGE_VIEW_ACTIVATE

#define EVENT_MESSAGE_VIEW_ACTIVATE   0x0160

Window activated.

§ EVENT_MESSAGE_VIEW_CREATE

#define EVENT_MESSAGE_VIEW_CREATE   0x0163

Window created.

§ EVENT_MESSAGE_VIEW_DESTROY

#define EVENT_MESSAGE_VIEW_DESTROY   0x0164

Window destroyed.

§ EVENT_MESSAGE_VIEW_MODE_CHANGED

#define EVENT_MESSAGE_VIEW_MODE_CHANGED   0x0161

View changed on a window.

§ EVENT_MESSAGE_WEATHER_CHANGED

#define EVENT_MESSAGE_WEATHER_CHANGED   0x0133

If there's any change in the weather, this message will get sent.

§ EVENT_MESSAGE_WEATHER_MODE_CHANGED

#define EVENT_MESSAGE_WEATHER_MODE_CHANGED   0x0138

Weather system mode (i.e. RWW, theme, custom) has been changed.

Variable Documentation

§ EVENTID_1Hz

GUID EVENTID_1Hz

This event is signaled once per frame.

§ EVENTID_CustomObjectDraw

GUID EVENTID_CustomObjectDraw

This event is signaled once per view each frame. The IParameterListV400 can be used to request the IObjectRendererV400 service, which can be used to render custom objects into the scene. See the CustomLights example for more details. (SDK)

§ EVENTID_Frame

GUID EVENTID_Frame

Event that is signaled once per frame.

§ EVENTID_Message

GUID EVENTID_Message

Event that is fired whenever a Prepar3D message is sent. The EVENT_MESSAGE_ message ID will be the first parameter of the EVENTID_Message callback. A sample message handler is included below:

virtual void Invoke(IP3DCallbackParams* pParams)
{
UINT64 messageID = pParams->GetParameter(0).Value;
{
// handle app shutdown
}
}

§ IID_ICallbackV400

REFIID IID_ICallbackV400 = __uuidof(ICallbackV400)

§ IID_IEventServiceV400

REFIID IID_IEventServiceV400 = __uuidof(IEventServiceV400)

§ IID_IParameterListV400

REFIID IID_IParameterListV400 = __uuidof(IParameterListV400)

§ SID_EventService

REFIID SID_EventService = __uuidof(IEventServiceV400)