Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
21.04.2004, 15:01
hutramo



hi :-)
es geht um c++ und würde gern wissen, wie ich in meinem kleinem programm die toasc funktion benutze.

#include <iostream>
#include <stdlib.h>
#include <winuser.h>
using namespace std;

int main()
{
char blubb;
char test;
int hop;

cin >> test;
test = blubb;
hop = ToAscii(test);
cout << hop;


system("PAUSE");
return 0;
}

ich bekomme immer einen fehler in der winuser.h der heisst:

too few arguments for function int
auf die zeile
hop = ToAscii(test);
bezogen.

wie muss ich es richtig machen ?

--

Zufall existiert nicht. Es ist alles Bestimmung !

zum Seitenanfang zum Seitenende Profil || Suche
001
21.04.2004, 15:11
Ready



MSDN :

Quellcode:The ToAscii function translates the specified virtual-key code and keyboard state to the corresponding character or characters. The function translates the code using the input language and physical keyboard layout identified by the keyboard layout handle.

To specify a handle to the keyboard layout to use to translate the specified code, use the ToAsciiEx function.


Syntax

int ToAscii(          UINT uVirtKey,
    UINT uScanCode,
    PBYTE lpKeyState,
    LPWORD lpChar,
    UINT uFlags
);
Parameters

uVirtKey
[in] Specifies the virtual-key code to be translated.
uScanCode
[in] Specifies the hardware scan code of the key to be translated. The high-order bit of this value is set if the key is up (not pressed).
lpKeyState
[in] Pointer to a 256-byte array that contains the current keyboard state. Each element (byte) in the array contains the state of one key. If the high-order bit of a byte is set, the key is down (pressed).
The low bit, if set, indicates that the key is toggled on. In this function, only the toggle bit of the CAPS LOCK key is relevant. The toggle state of the NUM LOCK and SCROLL LOCK keys is ignored.

lpChar
[out] Pointer to the buffer that receives the translated character or characters.
uFlags
[in] Specifies whether a menu is active. This parameter must be 1 if a menu is active, or 0 otherwise.
Return Value


If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values.


Value Meaning
0 The specified virtual key has no translation for the current state of the keyboard.
1 One character was copied to the buffer.
2 Two characters were copied to the buffer. This usually happens when a dead-key character (accent or diacritic) stored in the keyboard layout cannot be composed with the specified virtual key to form a single character.


Remarks

The parameters supplied to the ToAscii function might not be sufficient to translate the virtual-key code, because a previous dead key is stored in the keyboard layout.

Typically, ToAscii performs the translation based on the virtual-key code. In some cases, however, bit 15 of the uScanCode parameter may be used to distinguish between a key press and a key release. The scan code is used for translating ALT+ number key combinations.

Although NUM LOCK is a toggle key that affects keyboard behavior, ToAscii ignores the toggle setting (the low bit) of lpKeyState (VK_NUMLOCK, because the uVirtKey parameter alone is sufficient to distinguish the cursor movement keys (VK_HOME, VK_INSERT, and so on) from the numeric keys (VK_DECIMAL, VK_NUMPAD0 - VK_NUMPAD9).

Function Information

Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1

--

zum Seitenanfang zum Seitenende Profil || Suche
002
21.04.2004, 15:13
hutramo



thx :D

danke für die schnelle hilfe

--

Zufall existiert nicht. Es ist alles Bestimmung !

zum Seitenanfang zum Seitenende Profil || Suche