Solved

SetTimer Function call ...

Posted on 1998-10-12
5
187 Views
Last Modified: 2013-11-20
Is there someone out there who can give me an example of the CListBox.SetTimer(), CListBox.OnTimer() and CListBox.KillTimer()?
0
Comment
Question by:ndb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 2

Expert Comment

by:jrmcg
ID: 1323203
What exactly are you trying to do?  The CListBox does not have a timer function of its own that I am aware of.  I can help you write a Timer if you will tell me what you want to do with it... with respect to the CListBox.

J.R.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1323204
These are members of CWnd, the base class of CListBox (and a lot of other classes too, such as CView).

Look for examples of CWnd::SetTimer
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1323205
Typically, the timer is set within the controlling window's message loop and not within the control itself.  Then on the OnTimer, you will update the list box accordingly.  Otherwise, you'll will have to override the CListBox with a class of your own.

Phillip
0
 
LVL 1

Author Comment

by:ndb
ID: 1323206
I want to create some kind of buffer. When a user presses a key then a stringbuffer is created related to a timer. That buffer stays active for 1sec and is destroyed again unless the user pressed a key within that 1sec. The the timer is restarted again.
0
 
LVL 7

Accepted Solution

by:
psdavis earned 100 total points
ID: 1323207
Alright, here's some pseudo-code.  I call it pseudo code in case I make a mistake :)

#define ID_TIMER_ON_CHAR  WM_USER + 102

CMyListBox::OnChar( )
{
.
   SetTimer( ID_TIMER_ON_CHAR, 1000, NULL );
}

// Override the WM_TIMER

void CMyListBox::OnTimer( UINT uiEvent )
{
   if( uiEvent == ID_TIMER_ON_CHAR )
   {
   // do what you want here!
      KillTimer( ID_TIMER_ON_CHAR );
   }

   CListBox::OnTimer( uiEvent );
   return;
}

Phillip
}

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
string initialization in java 11 122
modThree challenge 4 155
matchUp  challenge 9 134
Making an alias 7 121
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question