Solved

TSR in MS VC++ 6.0 based on Timer Interrupt

Posted on 2000-02-14
3
525 Views
Last Modified: 2008-02-01
I would like to write a TSR that would
check for existence of a file in a given
path every "5 minutes" and then do some
action based on it. I am using Pro*C
to connect to Oracle to perform the action.
So my interrupt should be based on the timer.

I am using MS VC++ to do the C coding and precompiling with Pro*C and then compile and link in VC++.

Could anyone give me a sample code based on the timer interrupt ?
0
Comment
Question by:karthikesh
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 2519693
VC cannot generate TSRs.  TSRs must be DOS programs.

>> sample code based on the timer interrupt ?
You can't do this from VC.

But you could jsu create a windows program to do this.

Create a window for the program and hide it.  The use SetTimer() to create timer messages so your program can "wake up" and perform the checks when needed.   (You must have the window or the SetTimer() won't work, as it needs to send messages to a window, but you can hide the window if you don't want it.)

Let me know if you have any questions.
0
 

Author Comment

by:karthikesh
ID: 2520729
How to create a window "for this prog."?
Should SetTimer() be part of my prog.?
And will the timer cycle indefinitely for n times or is it just 1 time.
Could you please provide a framework ?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2521005
Those questions seem to be way beyond the scope of a single 100 points question.  

These are basic windows programming issues.  Do you know windows programing?, how to create windows, how to handle messages?

If not you need to get a book on windows programming, like "Programming Windows" by Charles Petzold.  After you understanad it you will be in much better shape to ask questions here.  (We can't be expected to answer questions that require 100s of pages of text and have been already answered in books, and undoubtably better answered too.)

If you know windows programming, then you can just create the window as usual and hide it with ShowWindow() using SW_HIDE.  You create the timer with SetTimer().  It will send you WM_TIMER messages at the interval you specify (ever 5 miutes).  The timer continues doing so until you destroy it with Killtimer().
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

813 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

10 Experts available now in Live!

Get 1:1 Help Now