Click here to Skip to main content
15,879,348 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: my icon in system tray always visible Pin
Member 104023906-May-14 9:32
professionalMember 104023906-May-14 9:32 
SuggestionRe: my icon in system tray always visible Pin
Richard MacCutchan6-May-14 9:50
mveRichard MacCutchan6-May-14 9:50 
GeneralRe: my icon in system tray always visible Pin
Member 104023906-May-14 10:06
professionalMember 104023906-May-14 10:06 
GeneralRe: my icon in system tray always visible Pin
Richard MacCutchan6-May-14 10:19
mveRichard MacCutchan6-May-14 10:19 
GeneralRe: my icon in system tray always visible Pin
Member 104023906-May-14 11:05
professionalMember 104023906-May-14 11:05 
QuestionTo fix the first column of ClistView grid control Pin
sma123#2-May-14 7:22
sma123#2-May-14 7:22 
GeneralRe: To fix the first column of ClistView grid control Pin
Richard MacCutchan2-May-14 7:33
mveRichard MacCutchan2-May-14 7:33 
Questionevent arithmetic Pin
bkelly137-Apr-14 15:27
bkelly137-Apr-14 15:27 
Windows 7, Visual Studio 2012, MFC, TCP/IP operations using API calls for high data rate application

I am writing a TCP/IP thread to send data to a display device. It is a high data rate output utility and will use overlapped I/O and WaitForMultipleObjects(…) to detect when the outputs are complete. The event array has 23 events and the last 16 are for an array of 16 buffers used to output the data.
The obvious way is to use a switch statement to detect each event returned by WaitForMultipleObjects(…). Can I do this instead?
Note: All this pseudo code is for illustrative purposes only. None is expected to compile much less run.

   // Array of addresses.  Value of zero = no data,    > 0 = address of data to send
message_pointer    message_address_array[ 16 ];
…
// not shown: code to send the data and specify the event associated with that send.  The overlapped
// API is expected to set the event when the I/O is complete.  Presume an output is in progress or just 
// completed when this Wait is reached.
event_detected = WaitForMultipleObjects(
            EVENT_ARRAY_SIZE,
            mp_common_data->event_array,
            WAIT_FOR_ANY_EVENT,
            WAIT_TIMEOUT_VALUE );
// error checking and timeout checking not shown
Switch( event_detected )
{
   case EVENT_START_RUNNING:
      {…  break;}   // several events not shown
   case IO_EVENT_01:  // no break;
   case IO_EVENT_02:  // no break;  etc, etc
   case IO_EVENT_16:  // no break;
   {
      event_index = event_detected  –   IO_EVENT_01;
      message_address_array[ event_index ] = 0;  // zero = output completed
      break;
   }
   Default {…}    
}


Will this concept work? Will it be faster than a separate case for each event? I think it will be easier to maintain.
Or: I just thought of this: Before the switch do this:

VB
event_index = event_detected  –   IO_EVENT_01;
if( event_index >= 0 && event_index <= LAST_EVENT )
    message_address_array[ event_index ] = 0;
else
    switch(…)  etc, etc


Obviously there would be error checking and significant overhead code. To the core question, in either case, I would be doing event arithmetic, in a fashion. Is this concept valid?

Again, this does not pretend to be working code, just some pseudo statement to illustrate a concept.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com


GeneralRe: event arithmetic Pin
Richard MacCutchan7-Apr-14 22:03
mveRichard MacCutchan7-Apr-14 22:03 
AnswerRe: event arithmetic Pin
pasztorpisti8-Apr-14 10:06
pasztorpisti8-Apr-14 10:06 
GeneralRe: event arithmetic Pin
bkelly138-Apr-14 15:55
bkelly138-Apr-14 15:55 
GeneralRe: event arithmetic Pin
pasztorpisti8-Apr-14 22:57
pasztorpisti8-Apr-14 22:57 
QuestionHow to create a SDI in the activex? Pin
Lux11177-Apr-14 5:11
Lux11177-Apr-14 5:11 
Questionhow to add atlbase.h in VC++2008 Express? Pin
Member 1070176026-Mar-14 8:20
Member 1070176026-Mar-14 8:20 
AnswerRe: how to add atlbase.h in VC++2008 Express? Pin
Richard MacCutchan26-Mar-14 22:59
mveRichard MacCutchan26-Mar-14 22:59 
AnswerRe: how to add atlbase.h in VC++2008 Express? Pin
వేంకటనారాయణ(venkatmakam)27-Mar-14 2:16
వేంకటనారాయణ(venkatmakam)27-Mar-14 2:16 
GeneralRe: how to add atlbase.h in VC++2008 Express? Pin
Member 1070176027-Mar-14 4:12
Member 1070176027-Mar-14 4:12 
Questionhow to add web service in VC++2010 Pin
Shivanand Gupta22-Mar-14 2:51
Shivanand Gupta22-Mar-14 2:51 
AnswerRe: how to add web service in VC++2010 Pin
Richard MacCutchan22-Mar-14 3:04
mveRichard MacCutchan22-Mar-14 3:04 
GeneralRe: how to add web service in VC++2010 Pin
Shivanand Gupta23-Mar-14 19:48
Shivanand Gupta23-Mar-14 19:48 
GeneralRe: how to add web service in VC++2010 Pin
Richard MacCutchan23-Mar-14 22:55
mveRichard MacCutchan23-Mar-14 22:55 
QuestionHow to Custom Image on a Built-In Ribbon Button by c++ Pin
Member 1023648726-Feb-14 0:21
Member 1023648726-Feb-14 0:21 
QuestionUnit Testing Framework Pin
J_Me17-Feb-14 22:27
professionalJ_Me17-Feb-14 22:27 
QuestionWCHAR copy one char at a time Pin
bkelly132-Feb-14 8:15
bkelly132-Feb-14 8:15 
AnswerRe: WCHAR copy one char at a time Pin
Richard MacCutchan2-Feb-14 21:56
mveRichard MacCutchan2-Feb-14 21:56 

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.