Esqualante [ Jyhad Baghadyr ]
Pytanie do wyjadaczy C++ :)
Mianowicie jak mozna pobrac warotsc klawisza extended (np strzałki lub klawiatura numeryczna).
Standardowo wyglada to tak:
int liczba;
liczba = getch();
A jak chcę mieć strzałki?
wysiu [ ]
Moze pomoze..
wysiu [ ]
2.)
Q. I want to know if it is possible to trap the up arrow and the down arrow keys. I am writing an application where I need to change the attributes of a character when the up arrow or down arrow key is pressed.
Basically, the screen will wait for keyboard input. The program will wait in an infinite loop and scan for key strokes. The user will not hit the return key after any key stroke. The data must be available immediately. Hitting return or ESC will cause the screen to close.
A. Your program can read the up and down arrows with getch(). Up arrow is translated to two codes, 0 and 72, and the down arrow is translated to 0, 80. I’m attaching a small program that reads keys with getch() and displays their codes. Another possibility is to use NWSNUT.
#include <nwconio.h>
#include <nwthread.h>
#include <stdio.h>
#include <stdlib.h>
int main( void)
int key;
puts( "Press keys to see their codes,
<Esc> for exit");
while (( key = getch()) != 27)
printf( "%d\n", key);
return EXIT_SUCCESS;
3.)
https://forums.devshed.com/t70083/s.html
Esqualante [ Jyhad Baghadyr ]
wysiu >>>>> Dzieki! Dziś już nie mam jak tego sprawdzić, ale jutro się tym zajmę. Jeszcze raz - THX!
wysiu [ ]
Prosz..:) A na przyszlosc polecam www.google.com:)
Quetzalcoatl [ Konsul ]
tylko nie zapomnij ze niektore kalwisze generuja 2 kody naraz, jak na przykad F1..F12
wtedy masz 1wszy kod ==0 a drugi kod to wlasciwy kod klawisza
na szczescie twoich strzalek to sie nie tyczy :P
Esqualante [ Jyhad Baghadyr ]
Quetzalcoatl >>>>> Na nieszczęście dotyczy ;) ale na szczęście już uzyskałem odpowiedź: należy dwa razy wykonać funkcję getch(), np:
int liczba, ext = 0;
liczba = getch();
if (liczba == 0) ext = getch();
cout << "Klawisz ma wartosc zwykla " << liczba << " i rozszerzona " << ext;
A teraz pytanie bardziej skomplikowane:
Jak mozna stworzyc sterownik do myszki? Tzn. jak wyłapać przzerwanie, narysowac kursor itp.
Esqualante [ Jyhad Baghadyr ]
Zapomniałem dodać - w trybie DOSowym, naturalnie, czyli np. C++ Builder 3.1
el f [ RONIN-SARMATA ]
Myślałem że chodzi o wyjadaczy witaminy C...
Isam [ Generaďż˝ ]
hehe na przyszlosc w takich pyatanich ...klania sie assambly language;]