Solved

Which MFC class to use?

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

687 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