We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,415 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

TSR programming

I was thinking about making a TSR program in C++. I did some googling but found that most of them are using "dos.h" headers. This is obsolete and its use is frowned upon. So how can I make a simple TSR program in C++ ?

3
Contributors
5
Replies
22 Hours
Discussion Span
9 Months Ago
Last Updated
6
Views
np complete
Posting Whiz
385 posts since Sep 2010
Reputation Points: 18
Solved Threads: 36
Skill Endorsements: 0

Assuming you are running Windows, the answer is, you don't. DOS TSRs required low-level access to the BIOS, and hooking an interrupt; they are notoriously badly behaved under Windows, even inside of the cosnole or a DOS box.

Under Windows, then the equivalent of a TSR is simply a program that launches without opening a window, and waits for the appropriate invocation. Usually, what you would do is put an icon in the system tray, and wait for it to be clicked to access the program. The 'classic' TSR invocation method of using some specific control-keystroke is discouraged, as it could conflict with other programs which use the same keystrokes.

Can you tell us more about the purpose and goals for this program, and why you want it to behave as a TSR?

Schol-R-LEA
Veteran Poster
1,042 posts since Oct 2010
Reputation Points: 452
Solved Threads: 167
Skill Endorsements: 11

This is obsolete and its use is frowned upon.

So are TSRs. If you're not into obsolete stuff, learn to write a Windows service (assuming Windows as the natural progression because you're talking about DOS).

deceptikon
Challenge Accepted
Administrator
3,457 posts since Jan 2012
Reputation Points: 822
Solved Threads: 474
Skill Endorsements: 57

So how can I code a program such that the program works in the background ?

np complete
Posting Whiz
385 posts since Sep 2010
Reputation Points: 18
Solved Threads: 36
Skill Endorsements: 0

Ah, now that would depend on the compiler you're using, at least to some degree, and whether you were using a framework of some kind (e.g., .NET, MFC) or calling Win32 directly. To start with, you would need to use a modern Windows compiler, so Turbo C++ isn't an option. Second, if you used a compiler other than Visual C++, you would need to use Win32 directly, or a third party windowing library such as Qt or wxWidgets, as the most common frameworks (MFC and .Net) are specific to Microsoft's compilers. Third, you'd need to be familiar with how to write a Windows application in general, which is quite different from writing a console application.

Schol-R-LEA
Veteran Poster
1,042 posts since Oct 2010
Reputation Points: 452
Solved Threads: 167
Skill Endorsements: 11

So how can I code a program such that the program works in the background ?

By reading my previous post: write a Windows service. Once again, I'm assuming that you're using a Windows based operating system, given the nature of the original question.

deceptikon
Challenge Accepted
Administrator
3,457 posts since Jan 2012
Reputation Points: 822
Solved Threads: 474
Skill Endorsements: 57

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0725 seconds using 2.69MB