Variables
StartSimulation: Start Simulation

Variables

const UINT RI_MESSAGE_STARTSIMULATION = RegisterWindowMessage(TEXT("RI_MESSAGE_STARTSIMULATION"))
 

Detailed Description

Variable Documentation

const UINT RI_MESSAGE_STARTSIMULATION = RegisterWindowMessage(TEXT("RI_MESSAGE_STARTSIMULATION"))

Message ID for the Request "start simulation":
RI_MESSAGE_STARTSIMULATION

Write Memory:

This function has no writer.

Read Memory:

This function has no reader.

Return Values for StartSimulation:

RI_NOERROR = Simulation succeeded
RI_NOTADDED = Simulation not succeeded
RI_START_RETRACTED = Simulation succeeded. Start was retracted
RI_TARGET_RETRACTED = Simulation succeeded. Target was retracted
RI_START_TARGET_RETRACTED = Simulation succeeded. Start and target was retracted

Description:

Sending this message will start a simulation.
Requires two previously added stop-off-points.
The remote interface will disable user interaction before executing the command and allow user interaction after the command if there was no previously call to BlockUserInteraction.

Example:

#define USE_LOADLIBRARY
#include "TNSRemoteInterfaceDll.h"
LPARAM GetUniqueID()
{
//generate unique ID
static LPARAM id = 0;
if (++id == 0) ++id; // do not use 0 !!!!!
return id;
}
inline LRESULT RI_MESSAGE( const UINT request, HWND h_client, LPARAM id )
{
//check if RI handle is valid
if ( !IsWindow( RI_GetTNS() ) )
//send the request
PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
return RI_NOERROR;
}
LRESULT CDlgMFC_StartSimulation::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_STARTSIMULATION )
{
if ( (LRESULT)wParam == RI_NOERROR )
//Simulation succeeded. errorcode (0)
else if ( (LRESULT)wParam == RI_NOTADDED)
//Simulation not succeeded, invalid points. errorcode (11)
else if ( (LRESULT)wParam == RI_START_RETRACTED )
//Simulation succeeded. errorcode (21)
else if ( (LRESULT)wParam == RI_TARGET_RETRACTED )
//Simulation succeeded. errorcode (22)
else if ( (LRESULT)wParam == RI_START_TARGET_RETRACTED )
//Simulation succeeded. errorcode (23)
else
//Simulation not succeeded. errorcode (-1)
}
return CDialog::WindowProc( message, wParam, lParam );
}
void CDlgMFC_StartSimulation::foo()
{
LPARAM id = GetUniqueID();
if ( RI_MESSAGE( RI_MESSAGE_STARTSIMULATION, GetSafeHwnd(), id ) == RI_NOERROR )
//message sending succeeded
else
//navigation software not running
}


Flowchart:

RI-StartSimulation.gif



© PTV Group 2020 Generated on Wed Apr 15 2020 12:47:52 for by doxygen 1.8.8