![]() |
||
Home · All Commands · First Steps · Tutorials · Demos · FAQ | ||
Remote Interface Documentation |
This Example shows how to switch the navigator into tracking mode.
We do not need to send data for this request, so the only thing we do is sending the correspondent message:
LPARAM id = GetUniqueID(); if ( RI_MESSAGE( RI_MESSAGE_STARTNAVIGATION, GetSafeHwnd(), id ) == RI_NOERROR ) { }
This will cause the navigation software to switch to the tracking mode.
In the WindowProc-function, we wait for the answer. The navigator will send the same message back and sets the wParam to the error code.
In this case, if wParam = RI_NOTADDED, the navigator switched successfully to the tracking mode:
LRESULT CDlgMFC_StartTracking::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam ) { if ( message == RI_MESSAGE_STARTNAVIGATION ) { if ( (LRESULT)wParam == RI_NOTADDED ) { //succeeded } . . . } }
#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() ) ) return RI_NAVIGATIONNOTACTIVE; PostMessage( RI_GetTNS(), request, WPARAM(h_client), id ); return RI_NOERROR; } LRESULT CDlgMFC_StartTracking::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam ) { //check messages for answer from RI if ( message == RI_MESSAGE_STARTNAVIGATION ) { if ( (LRESULT)wParam == RI_NOERROR ) //Navigation succeeded. errorcode (0) else if ( (LRESULT)wParam == RI_USER) //Navigation not succeeded, User abort Navigation. errorcode (20) else if ( (LRESULT)wParam == RI_NOTADDED) //Tracking Modus succeeded. errorcode (11) else if ( (LRESULT)wParam == RI_NOFIX) //Navigation not succeeded, no GPS Fix. errorcode (18) else if ( (LRESULT)wParam == RI_NOTRUN) //Navigation not succeeded, Route calculation failed. errorcode (17) else if ( (LRESULT)wParam == RI_START_RETRACTED ) //Navigation succeeded. Start was retracted. errorcode (21) else if ( (LRESULT)wParam == RI_TARGET_RETRACTED ) //Navigation succeeded. Target was retracted. errorcode (22) else if ( (LRESULT)wParam == RI_START_TARGET_RETRACTED ) //Navigation succeeded. Start and Target was retracted.errorcode (23) else //Navigation not succeeded. errorcode (-1) } return CDialog::WindowProc( message, wParam, lParam ); } void CDlgMFC_StartTracking::foo() { LPARAM id = GetUniqueID(); if ( RI_MESSAGE( RI_MESSAGE_STARTNAVIGATION, GetSafeHwnd(), id ) == RI_NOERROR ) //message sending succeeded else //navigation software not running }
© PTV AG 2011 | Generated on Fri Oct 14 2011 10:17:32 for RI by ![]() |