Solved

TSR in MS VC++ 6.0 based on Timer Interrupt

Posted on 2000-02-14
3
520 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

706 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

19 Experts available now in Live!

Get 1:1 Help Now