GRY-Online.pl --> Archiwum Forum

Pytanie do wyjadaczy C++ :)

19.11.2003
23:58
smile
[1]

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?



20.11.2003
00:07
[2]

wysiu [ ]

Moze pomoze..

20.11.2003
00:12
[3]

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

20.11.2003
00:17
smile
[4]

Esqualante [ Jyhad Baghadyr ]

wysiu >>>>> Dzieki! Dziś już nie mam jak tego sprawdzić, ale jutro się tym zajmę. Jeszcze raz - THX!

20.11.2003
00:20
smile
[5]

wysiu [ ]

Prosz..:) A na przyszlosc polecam www.google.com:)

20.11.2003
01:33
smile
[6]

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

20.11.2003
12:51
[7]

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.

20.11.2003
13:28
[8]

Esqualante [ Jyhad Baghadyr ]

Zapomniałem dodać - w trybie DOSowym, naturalnie, czyli np. C++ Builder 3.1

20.11.2003
13:31
smile
[9]

el f [ RONIN-SARMATA ]

Myślałem że chodzi o wyjadaczy witaminy C...

20.11.2003
13:42
[10]

Isam [ Generaďż˝ ]

hehe na przyszlosc w takich pyatanich ...klania sie assambly language;]

© 2000-2024 GRY-OnLine S.A.