473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Keyboard handling in C

Hi,

I'm trying to write a keyboard handle with Borland. I think the code
below should work, but it doesn't compile. The problem is I cannot set
the return of
getvect() to a void interrupt (*)(), ie

void interrupt (*old_int9)();

....

old_int9 = getvect (0x9);

I need a void interrupt function pointer so I can chain the old handle
to the new handle. Any help much appreciated. I'll attach the rest
of
the example program.
#include<stdlib.h>
#include<stdio.h>
#include<dos.h>
#include<conio.h>

#define TRUE 1
#define FALSE 0

void interrupt (*old_int9)();

void interrupt new_int9();

int scan_code,done = FALSE;

void interrupt new_int9()
{
disable();
scan_code = inport(0x60);
if (scan_code == 0x3b) done = TRUE; /* done = TRUE when F1 pressed */
old_int9(); /* chain the old interrupt */
enable();

}

void main ()
{
int old_scan_code;
char buffer[256];

clrscr();
old_int9 = getvect(0x9);
setvect (0x09,new_int9);

while (!done)
{ if (kbhit) getche();

}

setvect (0x09,old_int9);
}
Jan 21 '08 #1
2 3989
On Jan 21, 2:24*pm, anon856...@gmail.com wrote:
Hi,

I'm trying to write a keyboard handle with Borland. I think the code
below should work, but it doesn't compile. The problem is I cannot set
the return of
getvect() to a void interrupt (*)(), ie
[snip]

You want news:comp.os.msdos.programmer

In the C-FAQ, section 19 is on "System Dependencies" like keyboard
interrupts, etc., but it won't really address your questions.
Jan 21 '08 #2
an********@gmail.com wrote:
>
I'm trying to write a keyboard handle with Borland. I think the
code below should work, but it doesn't compile. The problem is I
cannot set the return of getvect() to a void interrupt (*)(), ie

void interrupt (*old_int9)();

...

old_int9 = getvect (0x9);

I need a void interrupt function pointer so I can chain the old
handle to the new handle. Any help much appreciated. I'll
attach the rest of the example program.
Modern Winders won't allow you to do that. You need to try a DOS
newsgroup, or possibly W98 or W95.

--
X-Mozilla-Status: 0009alconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 22 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Cyber | last post by:
Hello ! I want to catch any event on a PC by the interrupts (C++ under Linux). My first step is to catch everything from the keyboard. I have: ...
5
by: iKiLL | last post by:
Hi All I am new to Windows Mobile Development and I was hoping to get some advice on the best way to handle Screen size and cut copy and past. I am developing with VS2005 for Windows...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
8
by: RJ45 | last post by:
Hello, I am writing a shell in C. I need to intercept Signals like CTRL+C or CTRL+D and set to ignore them. This is on Unix, using gcc. my goal is to avoid users escaping the shell with SIGINT...
0
by: Fromethius | last post by:
Hi everyone. For the past day I've been trying to find a good way to handle keyboard input. Naturally, I wanted to just use WM_KEYDOWN and WM_KEYUP to handle my events, but they proven to have...
7
by: Brian Ward | last post by:
Hello ===== I am trying to do a simple exercise using Visual Studio C#. I have a form with one picturebox and some buttons. I want to be able to control a picture box graphic using the keyboard...
2
by: Justin | last post by:
So I have a keyboard hook that I have implemeted into my c# app. I need to not allow any hotkey actions to be performed when my app is opened. I can capture the key events and handle them if I want...
11
by: vbguy2008 | last post by:
Hi, I am coding a Windows Form Application in VB.NET 2008. I would like to clear the keyboard buffer or at least empty all outstanding key presses queued up for my application at certain points...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.