Click here to Skip to main content
16,004,901 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Question about an BYTE value changing into pointer, then array Pin
Chris Losinger24-Nov-09 5:19
professionalChris Losinger24-Nov-09 5:19 
AnswerRe: Question about an BYTE value changing into pointer, then array Pin
Nemanja Trifunovic24-Nov-09 5:34
Nemanja Trifunovic24-Nov-09 5:34 
GeneralRe: Question about an BYTE value changing into pointer, then array Pin
CPallini24-Nov-09 7:01
mveCPallini24-Nov-09 7:01 
GeneralRe: Question about an BYTE value changing into pointer, then array [modified] Pin
Nemanja Trifunovic24-Nov-09 7:11
Nemanja Trifunovic24-Nov-09 7:11 
GeneralRe: Question about an BYTE value changing into pointer, then array Pin
Iain Clarke, Warrior Programmer24-Nov-09 7:40
Iain Clarke, Warrior Programmer24-Nov-09 7:40 
GeneralRe: Question about an BYTE value changing into pointer, then array [modified] Pin
Nemanja Trifunovic24-Nov-09 8:01
Nemanja Trifunovic24-Nov-09 8:01 
AnswerRe: Question about an BYTE value changing into pointer, then array Pin
David Crow24-Nov-09 17:00
David Crow24-Nov-09 17:00 
QuestionC++ question for new grad Pin
chan1124-Nov-09 4:40
chan1124-Nov-09 4:40 
Hi there,

I have an application that should report the state of some sockets within the app but to different class. like if the socket number 0 is connected I send data 00010000 and if socket 0 is disconnected I send 00000000
if socket 1 is connected I send 00010001 and if it is disconnected I send 00000001 so the first 2 bytes shows if the socket is connected or not and the 2nd two bytes shows the socket number. here is the code:

void HHost::HCommsLink( LPVOID lpData )
{
MsgClass *pMsg;
pCmdWrapper_t CmdPkt;
TCHAR Buff[MIN_LOADSTRING];
INT BuffLen;

CmdPkt = ( pCmdWrapper_t )lpData;
try
{ if( CmdPkt )
{
// Format the State message.
memset( Buff, '\0', MIN_LOADSTRING );
BuffLen = 0;
// Socket State.
Buff[BuffLen++] = (( CmdPkt->Param1 >> 8 )& 0xFF );
Buff[BuffLen++] = ( CmdPkt->Param1 & 0xFF );
//Socket Number.
Buff[BuffLen++] = (( CmdPkt->Param2 >> 8 )& 0xFF );
Buff[BuffLen++] = ( CmdPkt->Param2 & 0xFF );
//send message to Ap.
if( pMsg = new MsgClass( HMSG_ORIGIN_IN, 0x00 ))
{
NewCnt++;
pMsg->Hdr.MsgType = 120;
pMsg->SetData( Buff, BuffLen );
// Send to APClass.
if( hMail->MboxPostTo( MBOX_WE_APClass, MBOX_DATA, ( LPVOID )pMsg, ( LPVOID )MBOX_LPARAM_MSG )> MBOX_ERR_SUCCESS )
{

LogError( "HHost", "HCommsLink", "Error: Sending Msg to AP class" );
delete pMsg;
DelCnt++;
}
}
}

}
catch( ... )
{
LogException( "HHost", "HCommsLink", 0 );
}
}

now I need to change the logic so that each message that I send has the info for all the sockets like if socket number 0 is up I send 00000001 and if socket 0 is down I send 00000000 and for socket 1 if it is up I send 00000010 .... finally if I send 00010111 that means sockets 0, 1, 2, and 4 are up and the rest are down, I need to care about 8 sockets, I am having difficulty implementing this.

I appreciate any help.

best Chan
AnswerRe: C++ question for new grad Pin
Dave Calkins24-Nov-09 4:53
Dave Calkins24-Nov-09 4:53 
GeneralRe: C++ question for new grad Pin
chan1124-Nov-09 5:03
chan1124-Nov-09 5:03 
GeneralRe: C++ question for new grad Pin
Dave Calkins24-Nov-09 12:53
Dave Calkins24-Nov-09 12:53 
GeneralRe: C++ question for new grad Pin
chan1126-Nov-09 10:31
chan1126-Nov-09 10:31 
QuestionProblem with installutil.exe while install a service... Pin
jain_MS24-Nov-09 1:25
jain_MS24-Nov-09 1:25 
AnswerRe: Problem with installutil.exe while install a service... Pin
loyal ginger24-Nov-09 3:16
loyal ginger24-Nov-09 3:16 
GeneralRe: Problem with installutil.exe while install a service... Pin
jain_MS24-Nov-09 3:56
jain_MS24-Nov-09 3:56 
QuestionData from DB to Excel Pin
hellogany23-Nov-09 22:50
hellogany23-Nov-09 22:50 
AnswerRe: Data from DB to Excel Pin
Rajesh R Subramanian23-Nov-09 22:54
professionalRajesh R Subramanian23-Nov-09 22:54 
AnswerRe: Data from DB to Excel Pin
Dave Calkins24-Nov-09 4:54
Dave Calkins24-Nov-09 4:54 
AnswerRe: Data from DB to Excel Pin
David Crow24-Nov-09 17:03
David Crow24-Nov-09 17:03 
AnswerRe: Data from DB to Excel Pin
T210226-Nov-09 21:17
T210226-Nov-09 21:17 
Questionmissing activex control test container in visual studio 2008 Pin
Game-point23-Nov-09 22:43
Game-point23-Nov-09 22:43 
QuestionGetDlgItemText Pin
sashoalm23-Nov-09 20:44
sashoalm23-Nov-09 20:44 
AnswerRe: GetDlgItemText Pin
CPallini23-Nov-09 20:52
mveCPallini23-Nov-09 20:52 
GeneralRe: GetDlgItemText Pin
sashoalm24-Nov-09 4:19
sashoalm24-Nov-09 4:19 
QuestionPrinting Image Pin
Benjamin Bruno23-Nov-09 20:13
Benjamin Bruno23-Nov-09 20:13 

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.