[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

TSR in MS VC++ 6.0 based on Timer Interrupt

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
karthikesh
Asked:
karthikesh
  • 2
1 Solution
 
nietodCommented:
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
 
karthikeshAuthor Commented:
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
 
nietodCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now