Click here to Skip to main content
15,885,244 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 8:43
Victor Nijegorodov8-Jan-19 8:43 
GeneralRe: VC++ 2017 redistributables versions. Pin
Maximilien8-Jan-19 9:01
Maximilien8-Jan-19 9:01 
GeneralRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 9:03
Victor Nijegorodov8-Jan-19 9:03 
QuestionSubclassing a listcontrol in dialog bar Pin
manoharbalu6-Jan-19 23:48
manoharbalu6-Jan-19 23:48 
AnswerRe: Subclassing a listcontrol in dialog bar Pin
Victor Nijegorodov7-Jan-19 2:12
Victor Nijegorodov7-Jan-19 2:12 
Questionupdating output value with timer and resetting if the timer exceeds a certain time or it has a new input value Pin
crucial19536-Jan-19 14:42
crucial19536-Jan-19 14:42 
SuggestionRe: updating output value with timer and resetting if the timer exceeds a certain time or it has a new input value Pin
David Crow6-Jan-19 14:59
David Crow6-Jan-19 14:59 
AnswerRe: updating output value with timer and resetting if the timer exceeds a certain time or it has a new input value Pin
leon de boer6-Jan-19 16:17
leon de boer6-Jan-19 16:17 
To do it by polling which you sort of imply with your pseudocode (It is better with interrupts if possible to trigger the 1 event).

You define an ID for the timer and a timer sample count
#define	IDT_TIMER_0 WM_USER + 100

UINT sampleCount = 0;

You set the timer interval
SetTimer(IDT_TIMER_0, 10, NULL);//10ms poll x 30 samples  = 300ms

You do the checks in on_timer call back function and reset the sample count if you find what you wanted
void OnTimer (UINT TimerVal)
{
    sampleCount++;
    if (sample_whatever == 1)
    {
         // output your 1
         sampleCount = 0;
    } else if (sampleCount == 30) 
    {
        // output your 0
        sampleCount = 0;     
    }
}

You can use KillTimer with the id to kill the timer at any time you like
KillTimer(IDT_TIMER_0);

There are more advanced techniques like using WaitForSingleObject but we need to know more about what the 1 is coming from.
In vino veritas


modified 6-Jan-19 22:33pm.

QuestionSeperate source code for the tokens in the compiler c++ Pin
Member 141086114-Jan-19 20:10
Member 141086114-Jan-19 20:10 
AnswerRe: Seperate source code for the tokens in the compiler c++ Pin
Richard MacCutchan4-Jan-19 22:08
mveRichard MacCutchan4-Jan-19 22:08 
AnswerRe: Seperate source code for the tokens in the compiler c++ Pin
jschell5-Jan-19 5:59
jschell5-Jan-19 5:59 
QuestionPostmessage Not Working With WH_GETMESSAGE-MFC Pin
srinivasankrishnaa1-Jan-19 20:11
srinivasankrishnaa1-Jan-19 20:11 
AnswerRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
Richard MacCutchan1-Jan-19 22:08
mveRichard MacCutchan1-Jan-19 22:08 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
srinivasankrishnaa1-Jan-19 22:25
srinivasankrishnaa1-Jan-19 22:25 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
Richard MacCutchan1-Jan-19 23:10
mveRichard MacCutchan1-Jan-19 23:10 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
leon de boer2-Jan-19 17:44
leon de boer2-Jan-19 17:44 
QuestionBasic Server/Client TCP/IP Software Examples Pin
Bram van Kampen1-Jan-19 12:26
Bram van Kampen1-Jan-19 12:26 
AnswerRe: Basic Server/Client TCP/IP Software Examples Pin
k50541-Jan-19 19:43
mvek50541-Jan-19 19:43 
AnswerRe: Basic Server/Client TCP/IP Software Examples Pin
leon de boer1-Jan-19 19:17
leon de boer1-Jan-19 19:17 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen2-Jan-19 13:57
Bram van Kampen2-Jan-19 13:57 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
jschell5-Jan-19 6:32
jschell5-Jan-19 6:32 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen6-Jan-19 12:22
Bram van Kampen6-Jan-19 12:22 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen8-Jan-19 14:48
Bram van Kampen8-Jan-19 14:48 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
jschell26-Jan-19 5:52
jschell26-Jan-19 5:52 
AnswerRe: Basic Server/Client TCP/IP Software Examples Pin
Richard MacCutchan6-Jan-19 22:35
mveRichard MacCutchan6-Jan-19 22:35 

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.