Solved

Which MFC class to use?

Posted on 1998-10-24
5
202 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Detect CR LF to each line 12 159
Window placement 17 82
Line meaning 9 85
sumHeights2  challenge 7 103
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 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