Solved

SetTimer Function call ...

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 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