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

Remote Interface Documentation

Classes | Variables

GetDayNight: Get day/night mode

Classes

struct  RI_CGetDayNight
 Data structure for the Request "GetDayNight". More...

Variables

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

Variable Documentation

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

Message ID for the Request "GetDayNight":
RI_MESSAGE_GETDAYNIGHT

Read Memory:

RI_GetDayNight_ReadData(LPARAM id, RI_CGetDayNight data);

Return Values for GetDayNight:

RI_NOERROR = read DayNight Mode success

Description:

Gets the actual Day/Night mode (true if day).

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_GetDayNight::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_GETDAYNIGHT )
    {
        if ( (LRESULT)wParam == RI_NOERROR)
        {
            //read DayNight Mode success. errorcode (0)
            // get the data from the shared memory
            RI_CGetDayNight data;
            LRESULT read_suc = RI_GetDayNight_ReadData( lParam, data );
            if ( read_suc != RI_NOERROR )
                //...data was overwritten. errorcode (-2)
            else
            {
                if (data.m_bDayNight)
                    TRACE(TEXT("Day Mode is set"));
                else
                    TRACE(TEXT("Night Mode is set"));
            }
        }
        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_GetDayNight::foo()
{
    LPARAM id = GetUniqueID();
    if ( RI_MESSAGE( RI_MESSAGE_GETDAYNIGHT, 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