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

Remote Interface Documentation

Classes | Functions | Variables

SystemInfo: Get information from the system

Classes

struct  RI_CSystemInfo
 Data structure for the Request "SystemInfo". More...

Functions

LRESULT RI_SystemInfo_ReadData (LPARAM, RI_CSystemInfo &)
 Read data from shared memory for "System information".

Variables

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

Variable Documentation

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

Message ID for the Request "system information":
RI_MESSAGE_SYSTEMINFO

Read Memory:

RI_SystemInfo_ReadData(LPARAM id, RI_CSystemInfo data );

Return Values for SystemInfo:

RI_NOERROR = System info succeeded

Description:

Returns system information like the current language, available languages, the current map, available maps and so on (see data structure for more details).

Returns a single package

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_SystemInfo::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_SYSTEMINFO )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            //read data from Shared Memory
            RI_CSystemInfo data;
            LRESULT read_suc = RI_SystemInfo_ReadData( lParam, data );
            //System info succeeded. errorcode (0)
            TRACE( TEXT("Programm Version:  %s"),data.m_Version );
            TRACE( TEXT("Programm Build:  %s"),data.m_Build );
            TRACE( TEXT("Current Map Name:  %s"),data.m_CurrentMapName);
            TRACE( TEXT("Current Map Date:  %s"),data.m_CurrentMapDate );
            TRACE( TEXT("Current Map Version:  %s"),data.m_CurrentMapVersion );
            for (int i=0; i<data.m_MapCount; i++)
            {
                TRACE(TEXT("Available Maps: %"s),data.m_AvailableMaps[i]);
            }
            TRACE( TEXT("Current Language:  %s"),data.m_CurrentLanguage );
            TRACE( TEXT("Available Language:  %s"),data.m_AvailableLanguages );
        }
        else
            //System info not succeeded. errorcode (-1)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_SystemInfo::foo()
{
    LPARAM id = GetUniqueID();
    if ( RI_MESSAGE( RI_MESSAGE_SYSTEMINFO, 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