Click here to Skip to main content
14,664,572 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Usage of bitset ? Pin
Vaclav_10-Jan-19 4:39
MemberVaclav_10-Jan-19 4:39 
QuestionVC++ 2017 redistributables versions. Pin
Maximilien8-Jan-19 4:21
MemberMaximilien8-Jan-19 4:21 
AnswerRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 8:43
MemberVictor Nijegorodov8-Jan-19 8:43 
GeneralRe: VC++ 2017 redistributables versions. Pin
Maximilien8-Jan-19 9:01
MemberMaximilien8-Jan-19 9:01 
GeneralRe: VC++ 2017 redistributables versions. Pin
Victor Nijegorodov8-Jan-19 9:03
MemberVictor Nijegorodov8-Jan-19 9:03 
QuestionSubclassing a listcontrol in dialog bar Pin
manoharbalu6-Jan-19 23:48
Membermanoharbalu6-Jan-19 23:48 
AnswerRe: Subclassing a listcontrol in dialog bar Pin
Victor Nijegorodov7-Jan-19 2:12
MemberVictor 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
Membercrucial19536-Jan-19 14: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 14:59
MemberDavid 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
Memberleon de boer6-Jan-19 16:17 
QuestionSeperate source code for the tokens in the compiler c++ Pin
Member 141086114-Jan-19 20:10
MemberMember 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
Memberjschell5-Jan-19 5:59 
QuestionPostmessage Not Working With WH_GETMESSAGE-MFC Pin
srinivasankrishnaa1-Jan-19 20:11
Membersrinivasankrishnaa1-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
Membersrinivasankrishnaa1-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
Memberleon de boer2-Jan-19 17:44 
QuestionBasic Server/Client TCP/IP Software Examples Pin
Bram van Kampen1-Jan-19 12:26
MemberBram 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
Memberleon de boer1-Jan-19 19:17 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen2-Jan-19 13:57
MemberBram van Kampen2-Jan-19 13:57 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
jschell5-Jan-19 6:32
Memberjschell5-Jan-19 6:32 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen6-Jan-19 12:22
MemberBram van Kampen6-Jan-19 12:22 
GeneralRe: Basic Server/Client TCP/IP Software Examples Pin
Bram van Kampen8-Jan-19 14:48
MemberBram van Kampen8-Jan-19 14: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.