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

Remote Interface Documentation

Classes | Variables

SetBuddyPosition: set the position for a buddy tracking icon

Classes

struct  RI_CSetBuddyPosition
 Data structure for the Request "SetBuddyPosition". More...

Variables

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

Variable Documentation

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

Message ID for the Request "SetBuddyPosition":
RI_MESSAGE_SETBUDDYPOSITION

Write Memory:

RI_SetBuddyPosition_WriteData(LPARAM id, RI_CSetBuddyPosition data);

Return Values for SetBuddyPosition:

RI_NOERROR = set buddy position succeeded
RI_NOTADDED = set buddy position not succeeded, because the coordinate is not valid.
RI_NOTAV = set buddy position not succeeded, could not set coordinate for this buddyId.

Description:

set the position for a buddy tracking icon.

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_SetBuddyPosition::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_SETBUDDYPOSITION )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            //set buddy position succeeded. errorcode (0)
        }
        else if ( (LRESULT)wParam == RI_NOTAV)
        {
            //could not set position, for this buddyID
        }
        else if ( (LRESULT)wParam == RI_NOTADDED)
        {
            //the coordinate is not valid.
        }
        else if ( (LRESULT)wParam == RI_NAVIGATIONNOTACTIVE)
        {
            //Navigator is not running or the configuration is not complete. errorcode(3)
        }
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_SetBuddyPosition::foo()
{
    //define struct
    RI_CSetBuddyPosition data;
        data.m_BuddyID = 1;
    data.m_Mercator_x = 937185;
    data.m_Mercator_y = 6270130;
        //write data in shared memory
        LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_SetBuddyPosition_WriteData( id, data );
        if ( sharing_ret != RI_NOERROR ) 
        return;
        if ( RI_MESSAGE( RI_MESSAGE_SETBUDDYPOSITION, GetSafeHwnd(), id ) == RI_NOERROR )
                //message sending succeeded
        else
                //navigation software not running
}

© PTV AG 2011 Generated on Fri Oct 14 2011 10:17:33 for RI by doxygen 1.7.1