Solved

SetTimer Function call ...

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

14 Experts available now in Live!

Get 1:1 Help Now