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

Remote Interface Documentation

Classes | Variables

CreateBuddyTracking: create a buddy tracking icon

Classes

struct  RI_CCreateBuddyTracking
 Data structure for the Request "CreateBuddyTracking". More...

Variables

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

Variable Documentation

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

Message ID for the Request "CreateBuddyTracking":
RI_MESSAGE_CREATEBUDDYTRACKING

Write Memory:

RI_CreateBuddyTracking_WriteData(LPARAM id, RI_CCreateBuddyTracking data);

Return Values for CreateBuddyTracking:

RI_NOERROR = create buddy tracking succeeded
RI_NOTFOUND = create buddy tracking not succeeded, no icon found
RI_NOTADDED = create buddy tracking not succeeded, could not create buddy

Description:

create a buddy tracking icon.
The file must be present in the oem-directory of the navigation software and the bitmap filename has to be given without path extensions, e.g. don't use "/truck/oem/car.png" but "car.png".

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_CreateBuddyTracking::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_CREATEBUDDYTRACKING )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            //create buddy tracking succeeded. errorcode (0)
            RI_CCreateBuddyTracking data;
                        LRESULT read_suc = RI_CreateBuddyTracking_ReadData( lParam, data );
                        //read m_BuddyID
        }
        else if ( (LRESULT)wParam == RI_NOTFOUND)
        {
            //No Icon found
        }
        else if ( (LRESULT)wParam == RI_NOTADDED)
        {
            //could not create buddy
        }
        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_CreateBuddyTracking::foo()
{
    //define struct
    RI_CCreateBuddyTracking data;
    //copy data
    wcscpy(data.m_BMPFileName,L"car.png");
    //write data in shared memory
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_CreateBuddyTracking_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_CREATEBUDDYTRACKING, 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