Classes | Functions | Variables
SearchAddress: Convert an address string to a mercator position

Classes

struct  RI_CSearchAddress
 Data structure for the Request "SearchAddress". More...
 

Functions

LRESULT RI_SearchAddress_ReadData (LPARAM, RI_CSearchAddress &)
 Read data from shared memory for "SearchAddress".
 
LRESULT RI_SearchAddress_WriteData (LPARAM, RI_CSearchAddress &)
 Write data to shared memory for "SearchAddress".
 

Variables

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

Detailed Description

Variable Documentation

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

Message ID for the Request "search address":
RI_MESSAGE_SEARCHADDRESS

Write Memory:

RI_SearchAddress_WriteData(LPARAM id, RI_CSearchAddress data );

Read Memory:

RI_SearchAddress_ReadData(LPARAM id, RI_CSearchAddress data );

Return Values for SearchAddress:

RI_NOERROR = Search address succeeded
RI_NOTAV = SearchAddress no street found
RI_NOTFOUND = No Address found

Description:

Converts an address-string to a mercator position. If the return value is "RI_NOTAV", the returned coordinates will be the center of the town (for more details, see description in data structure).

Returns a single package.

<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_SearchAddress::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_SEARCHADDRESS )
{
if ( (LRESULT)wParam == RI_NOERROR )
{
//SearchAddress succeeded. errorcode (0)
//get the data from the shared memory
LRESULT read_suc = RI_SearchAddress_ReadData( lParam, data );
if ( read_suc != RI_NOERROR )
//...data was overwritten. errorcode (-2)<BR>
else
{
TRACE(TEXT("X-Koordinate: %i\n"), data.m_mercator_x);
TRACE(TEXT("Y-Koordinate: %i\n"), data.m_mercator_y);
TRACE(TEXT("Result Address: %s\n"), data.m_result_address);
}
}
else if ( (LRESULT)wParam == RI_NOTAV )
{
//SearchAddress has no street found. errorcode (19)
//get the data from the shared memory
LRESULT read_suc = RI_SearchAddress_ReadData( lParam, data );
if ( read_suc != RI_NOERROR )<BR>
//...data was overwritten. errorcode (-2)
else
{
TRACE(TEXT("X-Koordinate: %i\n"), data.m_mercator_x);
TRACE(TEXT("Y-Koordinate: %i\n"), data.m_mercator_y);
TRACE(TEXT("Result Address: %s\n"), data.m_result_address);
}
}
else
//SearchAddress not succeeded. errorcode (-1)
}
return CDialog::WindowProc( message, wParam, lParam );
}
void CDlgMFC_SearchAddress::foo()
{
//*** copy data ***
wcscpy(data.m_address, L"D,76131,Karlsruhe,Stumpfstrasse,1");
//*** write data in shared memory ***
LPARAM id = GetUniqueID();
LRESULT sharing_ret = RI_SearchAddress_WriteData( id, data );
if ( sharing_ret != RI_NOERROR )
return;
if ( RI_MESSAGE( RI_MESSAGE_SEARCHADDRESS, 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