Click here to Skip to main content
15,798,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Usage of bitset ? Pin
Vaclav_10-Jan-19 5:39
Vaclav_10-Jan-19 5:39 
QuestionVC++ 2017 redistributables versions. Pin
Maximilien8-Jan-19 5:21
Maximilien8-Jan-19 5:21 
AnswerRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 9:43
Victor Nijegorodov8-Jan-19 9:43 
GeneralRe: VC++ 2017 redistributables versions. Pin
Maximilien8-Jan-19 10:01
Maximilien8-Jan-19 10:01 
GeneralRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 10:03
Victor Nijegorodov8-Jan-19 10:03 
QuestionSubclassing a listcontrol in dialog bar Pin
manoharbalu7-Jan-19 0:48
manoharbalu7-Jan-19 0:48 
AnswerRe: Subclassing a listcontrol in dialog bar Pin
Victor Nijegorodov7-Jan-19 3:12
Victor Nijegorodov7-Jan-19 3: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 15:42
crucial19536-Jan-19 15:42 
Good morning everyone.
I am a newbie in c++ coding and recently encountered a problem related to timer.

Note: i am with MFC, so I can use the timer from MFC. but not sure how to about it.

what I have to do is looks something like this;

if (input = 1)

{
start timer for 300ms ;
output = 1 ;
}

if ( new input within 300ms = 1)
{
restart the timer for 300ms;
output = 1;
}

if (input != 1 after 300ms || time elasped > 300ms )
{
output = 0;
}

I have a a stream of input 0 and 1 coming from an array. requirement is that after the program received an input of 1 from the array, it should give output of 1 for 300ms, if it doesn't recieve any other input that is 1 within 300ms, it would set the output to 0 but if it received and input of 1 within 300ms, it would reset the timer and give output as 1 for next 300ms.

I have never worked with timer based programming in c++. so I can't find any ideas about how to do it. If anyone can provide me an answer or point me in right direction, I would be really grateful.
Thank you very much for time replying to my query.

modified 6-Jan-19 21:04pm.

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 15:59
David Crow6-Jan-19 15: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 17:17
leon de boer6-Jan-19 17:17 
QuestionSeperate source code for the tokens in the compiler c++ Pin
Member 141086114-Jan-19 21:10
Member 141086114-Jan-19 21:10 
AnswerRe: Seperate source code for the tokens in the compiler c++ Pin
Richard MacCutchan4-Jan-19 23:08
mveRichard MacCutchan4-Jan-19 23:08 
AnswerRe: Seperate source code for the tokens in the compiler c++ Pin
jschell5-Jan-19 6:59
jschell5-Jan-19 6:59 
QuestionPostmessage Not Working With WH_GETMESSAGE-MFC Pin
srinivasankrishnaa1-Jan-19 21:11
srinivasankrishnaa1-Jan-19 21:11 
AnswerRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
Richard MacCutchan1-Jan-19 23:08
mveRichard MacCutchan1-Jan-19 23:08 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
srinivasankrishnaa1-Jan-19 23:25
srinivasankrishnaa1-Jan-19 23:25 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
Richard MacCutchan2-Jan-19 0:10
mveRichard MacCutchan2-Jan-19 0:10 
GeneralRe: Postmessage Not Working With WH_GETMESSAGE-MFC Pin
leon de boer2-Jan-19 18:44
leon de boer2-Jan-19 18:44 
QuestionBasic Server/Client TCP/IP Software Examples Pin
Bram van Kampen1-Jan-19 13:26
Bram van Kampen1-Jan-19 13:26 
AnswerRe: Basic Server/Client TCP/IP Software Examples Pin
k50541-Jan-19 20:43
mvek50541-Jan-19 20:43 
AnswerRe: Basic Server/Client TCP/IP Software Examples Pin
leon de boer1-Jan-19 20:17
leon de boer1-Jan-19 20:17 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen2-Jan-19 14:57
Bram van Kampen2-Jan-19 14:57 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
jschell5-Jan-19 7:32
jschell5-Jan-19 7:32 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen6-Jan-19 13:22
Bram van Kampen6-Jan-19 13:22 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen8-Jan-19 15:48
Bram van Kampen8-Jan-19 15:48 

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.