Solved

Which MFC class to use?

Posted on 1998-10-24
5
199 Views
Last Modified: 2013-11-20
I'm quite new to VC++[5] and I would like some advice...
I am writing a simple program.
I want to create a class  which performs a few bsaic operations but also I can set a timer and catch the timer messages.
Which base class should I use?
Thanks.
0
Comment
Question by:bazzalar
5 Comments
 
LVL 1

Expert Comment

by:jdyer
Comment Utility
What type of program is this? Windows or console?

Is this a dialog application or a document/view app?

If it is a windows program then you can use timers. However, there is no timer class in MFC. Instead check out the API calls SetTimer and KillTimer. You will need override the OnTimer function of either your dialog or MainFrame class in order to catch timer events. Do this by going into the ClassWizard, pick the appropriate class and scroll down the messages list until you find WM_TIMER. Add the function.

I can help you more if you provide a little more information on what you are trying to do!

Regards,
  jdyer
0
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
If the class is for abstract operations, but you need it to be a window, use CWnd as a base class.  If you don't want it to have anything with windows, you don't need to use MFC at all. You can use SetTimer to set a callback form of timer (check it's 4rh parameter).
0
 

Expert Comment

by:rakeshkalra
Comment Utility
The question is not clear as specified in the above comments.
0
 
LVL 4

Expert Comment

by:pagladasu
Comment Utility
Please specify exactly what you want to do.
For most purposes, you can use the SetTimer function and map the WM_TIMER message. Write code in the OnTimer() function to do the needful.
0
 
LVL 1

Accepted Solution

by:
polimetla earned 100 total points
Comment Utility
Dear brother,

1. write  SetTimer(); in initinstance
2. throw class wizard overright OnTimer() funciton.
    what ever you want write code here.
3. in destructor write KillTimer()

any doubts please contact me

with regards,
Bhavani P Polimetla
Bhavani_73@hotmail.com











0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 122
WinWaitActive parameters 12 31
tripleUp challenge 7 65
zeroFront challenge 7 71
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

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

18 Experts available now in Live!

Get 1:1 Help Now