Builder.cz - Informacni server o programovani

Odběr fotomagazínu

Fotografický magazín "iZIN IDIF" každý týden ve Vašem e-mailu.
Co nového ve světě fotografie!

 

Zadejte Vaši e-mailovou adresu:

Kamarád fotí rád?

Přihlas ho k odběru fotomagazínu!

 

Zadejte e-mailovou adresu kamaráda:



previest scan alebo virtual code do unicode char

Seznam témat     Nová odpověď

Přihlásit se     Registrace     Zapomenuté heslo

Re: previest scan alebo virtual code do unicode char

Autor: TC ♂

10:34:03 08.02.2013

radomir napsal/a

Velmi pekne dakujem este by som chcel vediet resp. presne vysvetlit ako funguje>

dakujem



Kdyz chces, tak to presne vysvetli. Nikdo Ti nebrani.

Zdravim

TC

Citovat příspěvek

 

Re: previest scan alebo virtual code do unicode char

Autor: radomir ♂

7:48:01 08.02.2013

Velmi pekne dakujem este by som chcel vediet resp. presne vysvetlit ako funguje>

DWORD dwThreadID = GetWindowThreadProcessId(hActiveWindow, NULL);
HKL hKL = GetKeyboardLayout(dwThreadID);
BYTE lpKeyState[256];
GetKeyboardState(lpKeyState);
wchar_t sBuffer[3]={0,0,0};
//ToUnicodeEx(LPARAMSTRUCT->vkCode, LPARAMSTRUCT->scanCode , lpKeyState, sBuffer, sizeof(sBuffer)/16, 0, hKL);
//lpKeyState[VK_CAPITAL]=true => ak budeme stlacat klavesy tak sa budu pisat velke pismena tzn. nastavili sme CAPS LOCK na zapnutu klavesu atd.
lpKeyState[VK_SHIFT]=((GetAsyncKeyState(VK_SHIFT)>>8)&0xFF);
//lpKeyState[VK_SHIFT]=(GetAsyncKeyState(VK_SHIFT) & 0x8000); //nefunguje
lpKeyState[VK_CAPITAL]=(GetKeyState(VK_CAPITAL) & 1);
//lpKeyState[VK_NUMLOCK]=(GetKeyState(VK_NUMLOCK) & 1); //nefunguje




lpKeyState[VK_SHIFT]=((GetAsyncKeyState(VK_SHIFT)>>8)&0xFF)
detailny popis co sa robi

dakujem a este preco nefunguje numlock
lpKeyState[VK_NUMLOCK]=(GetKeyState(VK_NUMLOCK) & 1);

dakujem

Citovat příspěvek

 

Re: previest scan alebo virtual code do unicode char

Autor: TC ♂

11:22:51 07.02.2013

http://www.pcreview.co.uk/forums/keyboard-hooking-including-unicode-t3609763.html

Citovat příspěvek

 

Re: previest scan alebo virtual code do unicode char

Autor: TC ♂

9:17:01 05.02.2013

WM_CHAR ma ve wparam primo hodnotu v UTF-16

Zdravim

TC

Citovat příspěvek

 

previest scan alebo virtual code do unicode char

Autor: radomir ♂

13:18:34 04.02.2013

prosim vas je toto dobre riesenie

mam problem v tom ak stisnem na klavesu ô vyhodi ô ak prepnem klavesnicu opet na stisk ô vyhodi ô ale malo by vyhodit ;



LRESULT CALLBACK HookProc( int nCode, WPARAM wParam, LPARAM lParam ) { //f-cia pre nas hak
if (nCode < 0) return CallNextHookEx(hHook, nCode, wParam, lParam);
if (nCode == HC_ACTION) {// #define HC_ACTION 0 in winuser.h
if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP || wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) {
hActiveWindow = GetForegroundWindow();
if (hActiveWindow==NULL) strcpy(szWintit,"Without Name of Window"); else GetWindowText(hActiveWindow, szWintit, GetWindowTextLength(hActiveWindow) + 1);
KBDLLHOOKSTRUCT* LPARAMSTRUCT = (KBDLLHOOKSTRUCT*)lParam;
//Form1->Memo1->Lines->Add((char)MapVirtualKey(LPARAMSTRUCT->vkCode,MAPVK_VK_TO_CHAR));
//Form1->Memo1->Lines->Add((WideChar)MapVirtualKeyExW(LPARAMSTRUCT->vkCode,MAPVK_VK_TO_CHAR,GetKeyboardLayout(0)));

HWND hActive = GetActiveWindow();
DWORD dwThreadID = GetWindowThreadProcessId(hActive, NULL);
HKL hKL = GetKeyboardLayout(dwThreadID);
BYTE lpKeyState[256];
GetKeyboardState(lpKeyState);
wchar_t sBuffer[256];
//ToUnicodeEx(LPARAMSTRUCT->vkCode, LPARAMSTRUCT->scanCode , lpKeyState, sBuffer, sizeof(sBuffer)/16, 0, hKL);
int StatusOfTUE = ToUnicodeEx(MapVirtualKeyExW(LPARAMSTRUCT->scanCode,MAPVK_VSC_TO_VK_EX,hKL), MapVirtualKeyExW(LPARAMSTRUCT->vkCode,MAPVK_VK_TO_VSC_EX,hKL), lpKeyState, sBuffer, sizeof(sBuffer)/16, 0, hKL);
switch (StatusOfTUE) {
case -1: break; //The specified virtual key is a dead-key character (accent or diacritic). This value is returned regardless of the keyboard layout, even if several characters have been typed and are stored in the keyboard state. If possible, even with Unicode keyboard layouts, the function has written a spacing version of the dead-key character to the buffer specified by pwszBuff. For example, the function writes the character SPACING ACUTE (0x00B4), rather than the character NON_SPACING ACUTE (0x0301).
case 0: break; //The specified virtual key has no translation for the current state of the keyboard. Nothing was written to the buffer specified by pwszBuff
case 1: HookText+=WideString(sBuffer[0]); Form1->Memo1->Text=HookText; break; //One character was written to the buffer specified by pwszBuff.
case 2: break; //Two or more characters were written to the buffer specified by pwszBuff. The most common cause for this is that a dead-key character (accent or diacritic) stored in the keyboard layout could not be combined with the specified virtual key to form a single character. However, the buffer may contain more characters than the return value specifies. When this happens, any extra characters are invalid and should be ignored.
}

Citovat příspěvek

 

 

 

Přihlášení k mému účtu

Uživatelské jméno:

Heslo: