Home · All Commands · First Steps · Tutorials · Demos · FAQ
 

Remote Interface Documentation

Classes | Functions | Variables

ChangeApplicationOptions: Change the application options

Classes

struct  RI_CChangeApplicationOptions
 Data structure for the Request "ChangeApplicationOptions". More...

Functions

LRESULT RI_ChangeApplicationOptions_WriteData (LPARAM, RI_CChangeApplicationOptions &)
 Write data to shared memory for "Change Application Options".

Variables

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

Variable Documentation

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

Message ID for the Request "ChangeApplicationOptions":
RI_MESSAGE_CHANGEOPTIONS

Write Memory:

RI_ChangeApplicationOptions_WriteData(LPARAM id, RI_CChangeApplicationOptions data );

Return Values for ChangeApplicationOptions:

RI_NOERROR = Change application options succeeded

Description:

Set application options like using ferries or motorways, volume, avoid u-turns and so on (see data structure for more details).

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() ) ) 
        return RI_NAVIGATIONNOTACTIVE;
    //send the request
    PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
    return RI_NOERROR;
}

LRESULT CDlgMFC_ChangeApplicationOptions::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_CHANGEOPTIONS )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
            //Change application options succeeded. errorcode(0)
        else
            //Change application options not succeeded. errorcode(-1)
    }   
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_ChangeApplicationOptions::foo()
{
    //define struct
    RI_CChangeApplicationOptions data;
    // *** copy data ***
    data.m_ShowStreetNames = 1;
    data.m_ShowCompass = 1;
    data.m_ShowScale = 1;
    data.m_MapFacingNorth = 0;
    data.m_InfoLeftSide = 0;
    data.m_InfoRightSide = 0;
    data.m_DependentOnSpeed = 0;
    data.m_Volume = 80;
    data.m_AvoidUTurns = 1;
    data.m_MapInItinerary = 0;
    data.m_Vehicle = 6;
    data.m_Optimisation = 2;
    data.m_Motorway = 1;
    data.m_Ferries = 1;
    // *** write data in shared memory ***
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_ChangeApplicationOptions_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_CHANGEOPTIONS, 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 doxygen 1.7.1