Solved

SetTimer Function call ...

Posted on 1998-10-12
5
178 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now