473,394 Members | 1,717 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,394 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 3988
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.