Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to read Extended Keys?

Posted on 1997-03-27
6
Medium Priority
?
327 Views
Last Modified: 2010-05-18
I have Borland's Turbo C++ V4.5 and am trying to read extended keys, e.g. F1 - F12, etc., using "getch" and it doesn't work.  The exact same code in MS V C++ works just fine...What's up?
0
Comment
Question by:wmaes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 

Expert Comment

by:Phoenix020397
ID: 1162496
The getch function returns a 0 and in the next time you run getch it automatically returns another number, special to that specific extended key. I recommend for you to build a program that reads a key, checks if it is 0, if it is then reads for the next key and then prints 0:next number. If the first number is not 0 then let it print just the number. That way you can learn the ascii value of the keys and the extended keys value.
0
 

Author Comment

by:wmaes
ID: 1162497
Phoenix,
  Your proposed solution is what I am doing; which is not working in Borland's Turbo C++ 4.5, but is working in MS Vis C++ with the same exact code.  I do one "getch()" and test for if it is equal to 0, and if so, I do a second "getch()" to determine which extended key was pressed.  In Borland, the "getch()" doesn't do anything when an extended key is pressed.  It's as if I didn't press anything.  But, in MS Vis C++, it reads the extended key just fine.  So...that's my question, what's up with that?
0
 

Expert Comment

by:Phoenix020397
ID: 1162498
I see, I'm sorry, I can't help you out with that one since I don't have your version of BC++. Sorry.
But, maybe your BC++ is malfunctioning, try reinstalling it or asking that question someone who has that same program but didn't get it from you.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:wmaes
ID: 1162499
I don't know what else to try...I tried making the "target" an "application.exe", but that yielded some kind of owlMain error on linking.  The "easyWin" target option seems to be the only thing that produces an executeable, but it won't read the extended keys.
0
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 100 total points
ID: 1162500
Borlands 'EasyWin' is a shell that simulates a DOS-like console. But internally things are very different. Any keyboard input is first catched and processed by the shell and only certain keys are passed on to the 'getch' function.
Borland's 'EasyWin' and Microsofts 'EasyWin' are different, and Borland decided to filter out 'wrong' keys like the function-keys and ALT-key combination.
If you want to use function-keys you have to write a real Windows-program or use the DOS target.

You get a linker-error if you choose 'application' as target because you also choosed a Windows platform. A Windows-program must have a WinMain function (or OwlMain if you checked the 'OWL' checkbox), also you can't use 'getch' or other functions in <conio.h> in a Windows-program.
Try to use a 'application' target and 'DOS' platform.
0
 
LVL 3

Expert Comment

by:LucHoltkamp
ID: 1162501
I have the Borland 5.0 package, and it contains targets for every platform (DOS, WIN16 and WIN32), so when I read your question I assumed your package also supports all targets. But the TURBO 4.5 (not Borland 4.5) doesn't support all targets, but only the WIN16 target.
So if your compiler doesn't support DOS, maybe you've got the wrong compiler for your needs.
Perhaps this is a good time to start learning programming for Windows (in OWL). I can advise the book 'Programming with OWL for Windows' form Vic Broquard.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question