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"))
 

Detailed Description

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.

<h2>Description:</h2>set the position for a buddy tracking icon.<br>
<br>

<H2>Example:</H2>
#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_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
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 Group 2020 Generated on Wed Apr 15 2020 12:47:52 for by doxygen 1.8.8