Solved

Which MFC class to use?

Posted on 1998-10-24
5
203 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
ID: 1323804
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
ID: 1323805
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
ID: 1323806
The question is not clear as specified in the above comments.
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1323807
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
ID: 1323808
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 189
Smart Camera scanning and reading information 3 113
countEvens challenge 2 111
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 103
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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