Click here to Skip to main content
16,006,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: convert double to string? Pin
RvD20023-Jul-03 5:21
sussRvD20023-Jul-03 5:21 
AnswerRe: convert double to string? Pin
Ryan Binns3-Jul-03 5:23
Ryan Binns3-Jul-03 5:23 
AnswerRe: convert double to string? Pin
John M. Drescher3-Jul-03 5:24
John M. Drescher3-Jul-03 5:24 
GeneralRe: convert double to string? Pin
Ryan Binns3-Jul-03 5:28
Ryan Binns3-Jul-03 5:28 
GeneralRe: convert double to string? Pin
John M. Drescher3-Jul-03 5:31
John M. Drescher3-Jul-03 5:31 
GeneralRe: accessing elements of a struct that are in an array of structs Pin
Cedric Moonen3-Jul-03 4:48
Cedric Moonen3-Jul-03 4:48 
GeneralRe: accessing elements of a struct that are in an array of structs Pin
johnstonsk3-Jul-03 5:05
johnstonsk3-Jul-03 5:05 
GeneralRe: accessing elements of a struct that are in an array of structs Pin
AlexO3-Jul-03 5:27
AlexO3-Jul-03 5:27 
could you publish the code?
You might consider usage of MS specific __declspec(property) and ignore alignment example

#include <stdexcept>
typedef struct TSimSignal
{

TSimSignal(void * pData = 0) : m_pData(pData){}

__declspec(property(get=GetSimWriteFlag,put=PutSimWriteFlag))
int SimWriteFlag;
__declspec(property(get=GetDisplayReadFlag,put=PutDisplayReadFlag))
int DisplayReadFlag;

__declspec(property(get=GetValue,put=PutValue))
double Value[45];
__declspec(property(get=GetTimeStamp,put=PutTimeStamp))
double TimeStamp;

int GetSimWriteFlag()
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
int * pValue = reinterpret_cast<int*>(m_pData);
return *pValue;
}

void PutSimWriteFlag(int value)
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
int * pValue = reinterpret_cast<int*>(m_pData);
*pValue = value;
}

int GetDisplayReadFlag()
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
int * pValue = reinterpret_cast<int*>(m_pData) + 1;
return *pValue;
}

void PutDisplayReadFlag(int value)
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
int * pValue = reinterpret_cast<int*>(m_pData) + 1;
*pValue = value;
}

double GetValue(long index)
{
if(!m_pData || index < 0 || index >= 45)
throw std::out_of_range(__FUNCSIG__);
double * pArray = reinterpret_cast<double*>(reinterpret_cast<char*>(m_pData) + sizeof(int) * 2);
return pArray[index];
}

void PutValue (long index, double value)
{
if(!m_pData || index < 0 || index >= 45)
throw std::out_of_range(__FUNCSIG__);
double * pArray = reinterpret_cast<double*>(reinterpret_cast<char*>(m_pData) + sizeof(int) * 2);
pArray[index] = value;
}

double GetTimeStamp()
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
double * pValue = reinterpret_cast<double*>(reinterpret_cast<char*>(m_pData) + sizeof(int) * 2 + sizeof(double) * 45);
return *pValue;
}

void PutTimeStamp(double value)
{
if(!m_pData)
throw std::out_of_range(__FUNCSIG__);
double * pValue = reinterpret_cast<double*>(reinterpret_cast<char*>(m_pData) + sizeof(int) * 2 + sizeof(double) * 45);
*pValue = value;
}

protected:
void * m_pData;

}TSimSignal;

GeneralStopping a Mouse Click from changing keyboard focus Pin
fluxt3-Jul-03 4:03
fluxt3-Jul-03 4:03 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
basementman3-Jul-03 4:40
basementman3-Jul-03 4:40 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
fluxt3-Jul-03 5:07
fluxt3-Jul-03 5:07 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
Rage3-Jul-03 5:42
professionalRage3-Jul-03 5:42 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
Rage3-Jul-03 5:46
professionalRage3-Jul-03 5:46 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
fluxt3-Jul-03 5:48
fluxt3-Jul-03 5:48 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
Rage3-Jul-03 5:53
professionalRage3-Jul-03 5:53 
GeneralRe: Stopping a Mouse Click from changing keyboard focus Pin
Rage3-Jul-03 5:55
professionalRage3-Jul-03 5:55 
GeneralRetrieving internet connection ip in LAN Pin
Kuniva3-Jul-03 4:02
Kuniva3-Jul-03 4:02 
GeneralRe: Retrieving internet connection ip in LAN Pin
valikac3-Jul-03 7:35
valikac3-Jul-03 7:35 
GeneralRead/Write a monochrome image to/from a .bmp file Pin
Neha3-Jul-03 3:22
Neha3-Jul-03 3:22 
GeneralRe: Read/Write a monochrome image to/from a .bmp file Pin
Rage3-Jul-03 5:50
professionalRage3-Jul-03 5:50 
GeneralGetting data into combo boxes Pin
keegan3-Jul-03 2:25
keegan3-Jul-03 2:25 
GeneralRe: Getting data into combo boxes Pin
Cedric Moonen3-Jul-03 2:39
Cedric Moonen3-Jul-03 2:39 
GeneralRe: Getting data into combo boxes Pin
David Crow3-Jul-03 2:59
David Crow3-Jul-03 2:59 
GeneralRe: Getting data into combo boxes Pin
Rage3-Jul-03 3:02
professionalRage3-Jul-03 3:02 
GeneralRe: Getting data into combo boxes Pin
keegan3-Jul-03 3:25
keegan3-Jul-03 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.