Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help me to control SHIFT button

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm progrmming a program in DOS that using an editor as
in Turbo C. But I don't know how to use SHIFT + ->,<- for
marking a text

Thank you.
 
You can read ROM bios data address in DOS.
For example,

#include <stdio.h>
#include <conio.h>

#define KEY_ADDRESS 0x417 /* ROM BIOS data address */
#define KEY_RSHIFT 0x01
#define KEY_LSHIFT 0x02
#define KEY_CTRL 0x04
#define KEY_ALT 0x08
#define KEY_SCROLL 0x10
#define KEY_NUMLOCK 0x20
#define KEY_CAPSLOCK 0x40
#define KEY_INS 0x80


int main( void )
{
getch();

if( *((char*)KEY_ADDRESS) & (KEY_LSHIFT|KEY_RSHIFT) ) {
puts( &quot;Shift key was pressed&quot; );
}
return 0;
}

Compile and execute this program. And then it waits
a key input and you can press left or right shift key
at that time. Hold the shift key and now press enter
to return the 'getch' function. If this program works
fine for you, you can see the message
&quot;Shift key was pressed&quot;.
Hee S. Chung
heesc@netian.com
 
Oh... sorry... My answer was not correct...
You wanted to know the editor command...
Sorry...

Mark block begin Ctrl-K B
Mark block end Ctrl-K K
Mark single word Ctrl-K T
Copy block Ctrl-K C
Move block Ctrl-K V
Delete block Ctrl-K Y
Read block from disk Ctrl-K R
Write block from disk Ctrl-K W
Hide/display block Ctrl-K H
Print block Ctrl-K P

You can see this help screen by pressing
F1 and PGDN twice in Turbo C 2.0 Hee S. Chung
heesc@netian.com
 
If you're using Borlands products see in bios.h should be some getkeystate functions, I don't remember just now theyrs name. Use them to see which key is pressed and which not. So you sill detect(by using scan codes) the caps lock, left shift, fight shift and all other keys. John Fill
1c.bmp


ivfmd@mail.md
 
I misunderstood th@n's question.
It is possible to get shift key state using
my source code, but he wanted to know
how can he mark a block of text using
shift + direction keys like modern
programming editors - but it is not supported
by the Turbo C editor.
Hee S. Chung
heesc@netian.com
 
I'm very sorry Mr Hee S.Chung because I didn't ask clearly
Your first question is fully correct. Thank you very much

And I'm also thanks to JohnFIll, your reply is allright too. That function in <bios.h> is bioskey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top