Classes | Functions | Variables
ShowMessage: Show a messagebox

Classes

struct  RI_CShowMessage
 Data structure for the Request "ShowMessage". More...
 

Functions

LRESULT RI_ShowMessage_ReadData (LPARAM, RI_CShowMessage &)
 Read data from shared memory for "Show Message".
 
LRESULT RI_ShowMessage_WriteData (LPARAM, RI_CShowMessage &)
 Write data to shared memory for "Show Message".
 

Variables

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

Detailed Description

Variable Documentation

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

Message ID for the Request "show message":
RI_MESSAGE_SHOWMESSAGE

Write Memory:

RI_ShowMessage_WriteData(LPARAM id, RI_CShowMessage data );

Read Memory:

RI_ShowMessage_ReadData(LPARAM id, RI_CShowMessage data );

Return Values for ShowMessage:

RI_NOERROR = Message was shown
RI_NODESC = Message not shown, because no message was defined

Description:

Shows a Messagebox with Ok, Ok/Cancel or Yes/No-Button(s). Returns the button pressed from the user (see data-struct for 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() ) )
//send the request
PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
return RI_NOERROR;
}
LRESULT CDlgMFC_ShowMessage::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_SHOWMESSAGE )
{
if ( (LRESULT)wParam == RI_NOERROR )
{
//Message was shown. errorcode (0)
//read data from shared memory
LRESULT read_suc = RI_ShowMessage_ReadData( lParam, data );
TRACE(TEXT("Feedback: %i"),data.m_Feedback );
}
else if ( (LRESULT)wParam == RI_NODESC )
//Message was not shown, because no Message defined. errorcode (12)
}
return CDialog::WindowProc( message, wParam, lParam );
}
void CDlgMFC_ShowMessage::foo()
{
// *** copy data to the struct ***
wcscpy (data.m_MessageCaption, L"Information");
wcscpy (data.m_Message, L"You have reached the maximum driving time!");
data.m_MessageButton = 1;
// *** write data in the Shared memory***
LPARAM id = GetUniqueID();
LRESULT sharing_ret = RI_ShowMessage_WriteData( id, data );
if ( sharing_ret != RI_NOERROR )
return;
if ( RI_MESSAGE( RI_MESSAGE_SHOWMESSAGE, GetSafeHwnd(), id ) == RI_NOERROR )
//message sending succeeded
return;
else
//navigation software not running
return;
}

© PTV Group 2020 Generated on Wed Apr 15 2020 12:47:52 for by doxygen 1.8.8