logo
down
shadow

Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes


Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes

Content Index :

Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes
Tag : delphi , By : Star Gryphon
Date : November 25 2020, 07:27 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Delphi 5 IDE command-line return codes


Tag : delphi , By : Ronnie Carlin
Date : March 29 2020, 07:55 AM
Does that help The only help refers to the command line compiler dcc32.exe and not the IDE.
Replacing the delphi32.exe by dcc32.exe should solve your problem.

asp codes wont be executed on server


Tag : asp.net , By : Gipsy.D
Date : March 29 2020, 07:55 AM
This might help you You need to configure your server to process ASP pages. Start with this Running ASP.Net on a Linux based server
If you are using old legacy ASP (not ASP.NET) then you may have trouble this platform is not actively developed from more than 10 years now. It would be better to switch to more modern framework e.g. ASP.NET.

VC++ : Enumerate the list of virtual key codes along with scan codes for all the possible key combinations


Tag : visual-cpp , By : Pieter Taelman
Date : March 29 2020, 07:55 AM
like below fixes the issue Finally got a solution for this, reference https://dxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout.cpp
void
FillKbdState(PBYTE aKbdState,
    const ShiftState aShiftState)
{
    if (aShiftState & STATE_SHIFT) {
        aKbdState[VK_SHIFT] |= 0x80;
    }
    else {
        aKbdState[VK_SHIFT] &= ~0x80;
        aKbdState[VK_LSHIFT] &= ~0x80;
        aKbdState[VK_RSHIFT] &= ~0x80;
    }

    if (aShiftState & STATE_CONTROL) {
        aKbdState[VK_CONTROL] |= 0x80;
    }
    else {
        aKbdState[VK_CONTROL] &= ~0x80;
        aKbdState[VK_LCONTROL] &= ~0x80;
        aKbdState[VK_RCONTROL] &= ~0x80;
    }

    if (aShiftState & STATE_ALT) {
        aKbdState[VK_MENU] |= 0x80;
    }
    else {
        aKbdState[VK_MENU] &= ~0x80;
        aKbdState[VK_LMENU] &= ~0x80;
        aKbdState[VK_RMENU] &= ~0x80;
    }

    if (aShiftState & STATE_CAPSLOCK) {
        aKbdState[VK_CAPITAL] |= 0x01;
    }
    else {
        aKbdState[VK_CAPITAL] &= ~0x01;
    }
}

inline int32_t GetKeyIndex(uint8_t aVirtualKey)
{
    // Currently these 68 (NS_NUM_OF_KEYS) virtual keys are assumed
    // to produce visible representation:
    // 0x20 - VK_SPACE          ' '
    // 0x30..0x39               '0'..'9'
    // 0x41..0x5A               'A'..'Z'
    // 0x60..0x69               '0'..'9' on numpad
    // 0x6A - VK_MULTIPLY       '*' on numpad
    // 0x6B - VK_ADD            '+' on numpad
    // 0x6D - VK_SUBTRACT       '-' on numpad
    // 0x6E - VK_DECIMAL        '.' on numpad
    // 0x6F - VK_DIVIDE         '/' on numpad
    // 0x6E - VK_DECIMAL        '.'
    // 0xBA - VK_OEM_1          ';:' for US
    // 0xBB - VK_OEM_PLUS       '+' any country
    // 0xBC - VK_OEM_COMMA      ',' any country
    // 0xBD - VK_OEM_MINUS      '-' any country
    // 0xBE - VK_OEM_PERIOD     '.' any country
    // 0xBF - VK_OEM_2          '/?' for US
    // 0xC0 - VK_OEM_3          '`~' for US
    // 0xC1 - VK_ABNT_C1        '/?' for Brazilian
    // 0xC2 - VK_ABNT_C2        separator key on numpad (Brazilian or JIS for Mac)
    // 0xDB - VK_OEM_4          '[{' for US
    // 0xDC - VK_OEM_5          '\|' for US
    // 0xDD - VK_OEM_6          ']}' for US
    // 0xDE - VK_OEM_7          ''"' for US
    // 0xDF - VK_OEM_8
    // 0xE1 - no name
    // 0xE2 - VK_OEM_102        '\_' for JIS
    // 0xE3 - no name
    // 0xE4 - no name

    static const int8_t xlat[256] =
    {
        // 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
        //-----------------------------------------------------------------------
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 00
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 10
        0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 20
        1,  2,  3,  4,  5,  6,  7,  8,  9, 10, -1, -1, -1, -1, -1, -1,   // 30
        -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,   // 40
        26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, -1, -1, -1, -1,   // 50
        37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, -1, 49, 50, 51,   // 60
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 70
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 80
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // 90
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // A0
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 53, 54, 55, 56, 57,   // B0
        58, 59, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // C0
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, 65,   // D0
        -1, 66, 67, 68, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   // E0
        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1    // F0
    };

    return xlat[aVirtualKey];
}

void PopulateKeyMap(HKL aLayout)
{
    BYTE kbdState[256];
    memset(kbdState, 0, sizeof(kbdState));

    BYTE originalKbdState[256];
    // Bitfield with all shift states that have at least one dead-key.
    uint16_t shiftStatesWithDeadKeys = 0;
    // Bitfield with all shift states that produce any possible dead-key base
    // characters.
    uint16_t shiftStatesWithBaseChars = 0;

    ::GetKeyboardState(originalKbdState);

    int index = 0;

    // For each shift state gather all printable characters that are produced
    // for normal case when no any dead-key is active.

    for (ShiftState shiftState = 0; shiftState < 16; shiftState++) 
    {
        FillKbdState(kbdState, shiftState);

        for (uint32_t virtualKey = 0; virtualKey < 256; virtualKey++) 
        {
            int32_t vki = GetKeyIndex(virtualKey);

            if (vki < 0) 
            {
                continue;
            }

            wchar_t uniChars[5];
            int32_t ret =
                ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)uniChars,
                    ArrayLength(uniChars), 0, hCurrentKeyboardLayout);

            // neither a dead-key nor there is no translation
            if (ret > 0)
            {
                if (ret == 1) 
                {
                    // dead-key can pair only with exactly one base character.
                    shiftStatesWithBaseChars |= (1 << shiftState);
                }


                {
                    index++;

                    uniChars[ret] = '\0';

                    CString key_name(uniChars);

                    unsigned int scanCode = MapVirtualKeyEx(virtualKey, MAPVK_VK_TO_VSC, hCurrentKeyboardLayout);

                    // because MapVirtualKey strips the extended bit for some keys
                    switch (virtualKey)
                    {
                    case VK_LEFT: case VK_UP: case VK_RIGHT: case VK_DOWN: // arrow keys
                    case VK_PRIOR: case VK_NEXT: // page up and page down
                    case VK_END: case VK_HOME:
                    case VK_INSERT: case VK_DELETE:
                    case VK_DIVIDE: // numpad slash
                    case VK_NUMLOCK:
                    {
                        scanCode |= KF_EXTENDED; // set extended bit
                        break;
                    }
                    }

                    if (false == key_name.IsEmpty())
                    {
                        SmartPtr<KeyCodeInfo> key = (new KeyCodeInfo)->template DetachObject<KeyCodeInfo>();

                        if (key)
                        {
                            key->nIndex = index;
                            key->sVKCode = virtualKey;
                            key->nScanCode = scanCode;

                            keyboard_map[tstring(key_name.GetBuffer())] = key;
                        }
                    }// End if
                }
            }
        }
    }

    ::SetKeyboardState(originalKbdState);
}

geopy wont return proper coordinates for canadian postal codes


Tag : python , By : Brownell
Date : March 29 2020, 07:55 AM
should help you out I think the problem here is either the API you use for geopy does not support for CA zip code, or you don't set 'CA' as the country option. So when the geocode can't retrieve the info from the input, it returns None.
To achieve the same goal, I would prefer use pgeocode library.
import pgeocode
nomi = pgeocode.Nominatim('ca')
postal_code = "A1B C14"
location = nomi.query_postal_code(postal_code)
print(location.latitude, location.longitude)
47.5698 -52.7796

love2d just wont accept some codes


Tag : lua , By : Pavel K.
Date : March 29 2020, 07:55 AM
hope this fix your issue Every time I use this: , Lua is case-sensitive. The correct call is
love.graphics.setFont(love.graphics.newFont(50))
Related Posts Related QUESTIONS :
  • Small Command line scripter (like Autocad commands) one line editor
  • Delphi: How to set the default project in a project group?
  • Is there any way to run "dir" directly?
  • Where to download Delphi BDE 5.01
  • Delphi exe, will it run with just BDE configuration?
  • Looking for Delphi 4 professional/Quickreport
  • AcroPDF in Delphi - How do I scroll?
  • How retrive full path with file name or folder name from ShellTreeView/ShellListView
  • Sending a file from my application (Indy/Delphi) to an ASP page and then onto another server (Amazon S3)
  • Need to send a pasting command from one program to another?
  • Delphi, read data from 3rd party data field
  • Delphi 7 inheritance
  • Looking for a good Delphi unicode string library
  • How can I create a context menu for a Delphi component?
  • How to access a Cassandra distributed database from Delphi
  • How to avoid the focus on Delphi application?
  • Emulate terminal services
  • A better way of converting Codepage-1251 in RTF to Unicode
  • How to pass multiple different records (not class due to delphi limitations) to a function?
  • Resize PNG image
  • Easiest way to find previous instance of an application
  • Difference between GetPixel and Canvas.Pixels in Delphi
  • Get Current Pixel value using Scanline in Delphi
  • Delphi: hook ToggleSwitch manual State change to avoid a Click call
  • TRttiContext GetTypes not finding my types
  • Can you change the span of a control at run time which was created at run time in TGridPanel
  • How variables are catched inside anonymous method?
  • change x-axis label in xy value plot
  • when run "printui.exe /s",it return error code 33 (error_lock_acess),how to fix it?
  • I keep getting a read error when copying stream data
  • How to let the IDE know that I use ancestor variable?
  • Why doesn't this code break (array of pointers to pointers of record)
  • How to check a BLE device still connected with Delphi 10.3
  • Send Perform Message with Record
  • Delphi Rio 10.3.2: remove file from a ZIP file
  • I want to encrypt TidBytes with AES
  • How to get correct number of logical processors
  • Convert variant of type (Dispatch)
  • Can't check if class has been created
  • Bind parent object's event to temporary child object's method
  • Compiler bug with overloaded function
  • Delphi marquee progress bar
  • DirectX/DirectCompute CreateBuffer failure with error 0x80070057 (E_INVALIDARG)
  • Delphi resizable form completely remove caption bar
  • Does delphi-orm support enumeration types?
  • Creating object instance triggers AV
  • Delphi XE2: How to make properties settable at design time?
  • DrawTextEx not working with DT_RIGHT and Arial font
  • How do you modify a Delphi Panel so Alignment := taRightJustify renders Caption with slight right margin?
  • How to get the main thread of a console app to be MTA?
  • Creating XML document with IXMLNodes
  • Where can I find Delphi┬┤s component editor for TPopupMenu and TMenuItem?
  • Usage for LiveBinding
  • d2007 set dependency to external program
  • How to generate a GUID version 1 in Delphi?
  • Delphi ActionMainMenuBar Category Position
  • Delphi FMX dcpcrypt wrong result on macOS 64-bit
  • How can I check if a specific user has specific access rights on a folder/file in Delphi
  • Firemonkey Rotate Text
  • Is using AlignWithMargins when spacing between controls good option?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com