none
How to Intialise a Unicode of special characters in my array RRS feed

  • Question

  • Hi.,

          How to initialise unicode of special characters in my array as a character/MACRO & how do i call in v_pfnKeybdEvent .....

    In my program,If i pass the (array index ) 2nd argument in v_pfnKeybdEvent it will display the corresponding characters whichever i declared in my array(i shown my array below)..And  some symbols(!,@,#,$,%,^) are displayed with the help of shift key enabled...

    I want to know how to represent Euro Currency symbol 20ac(unicode)& london dollar symbol is 00a3 (unicode)...

     

    Example:

    If i pass 0x19 as a 2nd argument in v_pfnKeybdEvent ..it will enable a capslock key because i defined my array 19th( index) content is VK_CAPITAL....   (0x19 is a scan code )

     v_pfnKeybdEvent(v_uiPddId, 0x19, rgfKeyUp[iEvent]);

    Like that i have to pass a 2nd argument in v_pfnKeybdEvent  as a index & how to represent unicode characters in my array...(note my array is UINT8)...

     

     

    UINT8 ScanCodeToVKeyTable[] =

    {

    VK_F11,          //scan code 0

    VK_F12,          //scan code 1

    VK_SPACE,        //scan code 2

    VK_MENU,         //scan code 4

    0,

    0,

    VK_LEFT,        //scan code 6

    VK_BACK,        //scan code 7

    VK_SHIFT,       //scan code 8

    VK_CONTROL,     //scan code 9

    VK_PACKET, //VK_LMENU,              //scan code A,

    VK_RMENU,          

    VK_RIGHT,       //scan code C  

    VK_RETURN,

    VK_NUMPAD3,     //scan code E

    VK_NUMPAD6,     //scan code F 

    VK_NUMPAD9,     //scan code 10

    VK_RETURN,      //scan code 11

    VK_DOWN,        //scan code 12 

    VK_ESCAPE,      //scan code 13

    VK_NUMPAD2,     //scan code 14

    VK_NUMPAD5,     //scan code 15

    VK_NUMPAD8,     //scan code 16

    VK_NUMPAD0,     //scan code 17

    VK_UP,          //scan code 18 

    VK_CAPITAL,     //scan code 19

    VK_NUMPAD1,   //scan code 1A

    VK_NUMPAD4,     //scan code 1B

    VK_NUMPAD7,     //scan code 1C

    VK_PERIOD,       //scan code 1D  

    '4', //1E

    '6', //'6', //1F

    '6', //20

    '5', //21

    '2',

    'A',

    'B',

    }..

     

    Regards

    Saravanan G

     

     

    Thursday, August 19, 2010 5:35 AM

All replies

  • I don't know what all of that is about, but you would add 0xHHHH, where HHHH is the hexidecimal number associated with your unicode character.
    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Thursday, August 19, 2010 1:25 PM
    Moderator
  • Hi.,

    This is my keypad (s3c6410.cpp) layout file... I want to display special characters on my handheld devices ..so i must initialize a unicodes for special characters only ..now a normal character & numbers is working but other r not working ..if i pass correct hexa value for special characters it doesnt display... in my array i should include unicode ?........ 

     

     

     

    #include    <windows.h>

    #include    <keybddr.h>

     

    #include    <laymgr.h>

    #include    <devicelayout.h>

    #include    "winuserm.h"

    //#include   <winuser.h>

    #include <tchar.h>

     

    #include    "KeyMatrix.hpp"

    #define    VK_MATRIX_FN    0xC1

    #define RAP 1

    #define    ScanCodeTableFirst    0x00

    #define    ScanCodeTableLast    0x69

     

    UINT8 ScanCodeToVKeyTable[] =

    {

    VK_F11,          //scan code 0

    VK_F12,          //scan code 1

    VK_SPACE,        //scan code 2

    VK_MENU,         //scan code 4

    0,

    0,

    VK_LEFT,        //scan code 6

    VK_BACK,        //scan code 7

    VK_SHIFT,       //scan code 8

    VK_CONTROL,     //scan code 9

    VK_PACKET,

    VK_LMENU,              //scan code A,

    0,          

    VK_RIGHT,       //scan code C  

    0, //scan code 0x0D(function key)

    VK_NUMPAD3,     //scan code E

    VK_NUMPAD6,     //scan code F 

    VK_NUMPAD9,     //scan code 10

    VK_RETURN,      //scan code 11(ENTER KEY)

    VK_DOWN,        //scan code 12 

    VK_ESCAPE,      //scan code 13

    VK_NUMPAD2,     //scan code 14

    VK_NUMPAD5,     //scan code 15

    VK_NUMPAD8,     //scan code 16

    VK_NUMPAD0,     //scan code 17

    VK_UP,          //scan code 18 

    VK_CAPITAL,     //scan code 19

    VK_NUMPAD1,   //scan code 1A S_POUND, //

    VK_NUMPAD4,     //scan code 1B

    VK_NUMPAD7,     //scan code 1C

    VK_MENU, //VK_PERIOD,       //scan code 1D  

    '6', //0x1E

    '4', //'6', //0x1F

    '7', //0x20

    '5', //0x21

    '2', //0x22

    //VK_PERIOD,       //scan code 0x1D  

    VK_DECIMAL, //0x23

    VK_COMMA, //0x24

    VK_SEMICOLON, // '1', //0x25 //(,)

      VK_OEM_2, //'2', //0x26

    VK_SUBTRACT, //0x27

    'A', //0x28

    'B', //0x29

    'C' ,                //0x2A         

    '1', //0x2B

    '2', //0x2C,

    'D', //0X2D

    'E', //0x2E

    'F', //0x2F

    '3', //0x30

    'G', //0x31  

      'H', //0x32

     'I', //0x33

    '4', //0x34

    '5', //0x35

    'J', //0x36

    'K', //0x37

    'L', //0x38

    'M', //0x39

    'N', //0x3a

    'O', //0x3b

    '6', //0x3c

    'P', //0X3d

    'Q', //0x3e

    'R', //0x3f

    'S', //0x40

    '7', //0x41

    'T', //0x42

    'U', //0x43

    'V', //0X44

    '8', //0x45

    'W', //0x46

    'X', //0x47

    'Y', //0x48

    'Z', //0x49

    VK_LBRACKET, //scan code 0x4a

    VK_RBRACKET, //0x4b

    '3', //0x4c

    VK_MULTIPLY, //0x4d

    VK_ADD, //0x4e

    VK_OEM_MINUS, //scan code 0x4f

    VK_DIVIDE, //0x50

    VK_LBRACKET,    //0x51

    VK_F1, //0X52

    VK_F2, //0X53

    VK_F3, //0X54

    VK_F4, //0X55

    VK_F5, //0X56

    VK_F6, //0X57

    0, //0X58

    0, //0X59

    VK_F9, //0X5A

    VK_F10, //0x5B

    '9', //0x5c

    VK_PACKET, //0x5d

    VK_DBE_ROMAN, //0x5e

    0, //0x5f

    };

     

     

     

    static ScanCodeToVKeyData scvkEngUS = 

    {

        0,

        ScanCodeTableFirst,

        ScanCodeTableLast,

        ScanCodeToVKeyTable

    };

    #define ScanCodeTableSplFirst  0xc2a0

    #define ScanCodeTableSplLast   0xc2a5

    #define ScanCodeTableExtFirst  0xE000

    #define ScanCodeTableExtLast 0xE04F

     

    UINT8 ScanCodeToVKeyExtTable[] =

    {

    VK_T4,// VK_MENU,

    VK_T5,// '0',

        VK_T6,// '1' , // 0,

    VK_T7,//'9', //VK_T1,

        '6', //VK_T2,

        163,

    0,   //0,

    0, //0,

        0,

        0,

     

        0,

        VK_T4,

        VK_T5,

        VK_T6,

        0,

        0,

        0,

        0,

     

        0,

        VK_T7,

        VK_T8,

        VK_T9,

        0,

        0,

        0,

        0,

     

        0,

        VK_TTALK,

        0,

        0,

        0,

        0,

        0,

        0,

     

        0,

        VK_TEND,

        0,

        0,

        0,

        0,

        0,

        0,

     

        0,

        VK_TVOLUMEUP,

        VK_TVOLUMEDOWN,

        0,

        0,

        0,

        0,

        0,

     

        0,

        0,

        0,

        0,

        0,

        0,

        0,

        0,

     

        0,

        0,

        0,

        0,

        0,

        0,

        0,

        0,

    };

     

     

     

    static ScanCodeToVKeyData scvkEngExtUS = 

    {  

    0xe000,

        ScanCodeTableExtFirst,

        ScanCodeTableExtLast,

        ScanCodeToVKeyExtTable

    };

     

    static ScanCodeToVKeyData *rgscvkMatrixEngUSTables[] =

    {

        &scvkEngUS,

        &scvkEngExtUS

    };

     

     

    struct VirtualKeyMapping

    {

        UINT32    uiVk;

        UINT32    uiVkGenerated;

    };

     

     

    // Find a virtual key mapping in the given array.

    static

    const VirtualKeyMapping * FindRemappedKey(UINT32 uiVk,const VirtualKeyMapping *pvkMap,DWORD cvkMap)

    {

        const VirtualKeyMapping *pvkMapMatch = NULL;

        UINT ui;

     

        DEBUGCHK(pvkMap);

    RETAILMSG(1,(TEXT("FINDREMAPPEDKEY Function \r\n")));

    //RETAILMSG(1,(TEXT("cvkMap ==%x\r\n"),cvkMap));

        for (ui = 0; ui < cvkMap; ++ui)

        {

    // RETAILMSG(1,(TEXT("inside for loop cvkMap ==%x\r\n"),cvkMap));

    //RETAILMSG(1,(TEXT("pvkMap[ui].uiVk ==%x\r\n"),pvkMap[ui].uiVk));

            if (pvkMap[ui].uiVk == uiVk)

            {

    RETAILMSG(1,(TEXT("INSIDE IF LOOP OF pvkMapMatch\r\n")));

                pvkMapMatch = &pvkMap[ui];

                break;

            }

        }

     

        return pvkMapMatch;

    }

     

     

    #define IS_NUMLOCK_ON(ksf) (ksf & KeyShiftNumLockFlag)

     

    // Remapping function for the matrix keyboard

    static

    UINT

    WINAPI

    MatrixUsRemapVKey(

        const KEYBD_EVENT *pKbdEvents,

        UINT               cKbdEvents,

        KEYBD_EVENT       *pRmpKbdEvents,

        UINT               cMaxRmpKbdEvents

        )

    {

        SETFNAME(_T("MatrixUsRemapVKey"));

     

        static BOOL fFnDown = FALSE;

     

        UINT cRmpKbdEvents = 0;

        UINT ui;

    //RETAILMSG(1,(TEXT("MATRIXUSREMAPVKEY \r\n")));

    //RETAILMSG(1,(TEXT("pKbdEvents ==%x---*pKbdEvents ==%x\r\n"),pKbdEvents,*pKbdEvents));

    //RETAILMSG(1,(TEXT("*pKbdEvents ==%x\r\n"),*pKbdEvents));

    //RETAILMSG(1,(TEXT("cKbdEvents ==%x\r\n"),cKbdEvents));

    //RETAILMSG(1,(TEXT("pRmpKbdEvents ==%x---*pRmpKbdEvents ==%x\r\n"),pRmpKbdEvents,*pRmpKbdEvents));

    //RETAILMSG(1,(TEXT("*pRmpKbdEvents ==%x\r\n"),*pRmpKbdEvents));

    //RETAILMSG(1,(TEXT("cMaxRmpKbdEvents ==%x\r\n"),cMaxRmpKbdEvents));

        if (pRmpKbdEvents == NULL)

        {

            // 1 to 1 mapping

            DEBUGCHK(cMaxRmpKbdEvents == 0);

            return cKbdEvents;

        }

     

        DEBUGCHK(pKbdEvents != NULL);

     

        if (cMaxRmpKbdEvents < cKbdEvents)

        {

            DEBUGMSG(ZONE_ERROR, (_T("%s: Buffer is not large enough!\r\n"), pszFname));

    RETAILMSG(RAP, (_T("%s: Buffer is not large enough!\r\n"), pszFname));

            return 0;

        }

     

        for (ui = 0; ui < cKbdEvents; ++ui)

        {

            const KEYBD_EVENT *pKbdEventCurr = &pKbdEvents[ui];

            KEYBD_EVENT *pKbdEventRmpCurr = &pRmpKbdEvents[cRmpKbdEvents];

     

            // Copy the input key event to our remapped list

    //RETAILMSG(1,(TEXT("pKbdEventRmpCurr->uiVk==%x\r\n"),pKbdEventCurr->uiVk));

            pKbdEventRmpCurr->uiVk = pKbdEventCurr->uiVk;

    //RETAILMSG(1,(TEXT("pKbdEventRmpCurr->uiSc==%x\r\n"),pKbdEventCurr->uiSc));

            pKbdEventRmpCurr->uiSc = pKbdEventCurr->uiSc;

    //RETAILMSG(1,(TEXT("pKbdEventCurr->KeyStateFlags==%x\r\n"),pKbdEventCurr->KeyStateFlags));

            pKbdEventRmpCurr->KeyStateFlags = pKbdEventCurr->KeyStateFlags;

     

            const VirtualKeyMapping *pvkMap = NULL;

            BOOL fKeyDown = (pKbdEventCurr->KeyStateFlags & KeyStateDownFlag) != 0;

            UINT32 uiVkCurr = pKbdEventCurr->uiVk;

     

            if (uiVkCurr == VK_MATRIX_FN)

            {

                fFnDown = fKeyDown;

                // Fn virtual key does not get sent to the system so

                // do not increment cRmpKbdEvents.

                DEBUGMSG(ZONE_DEVICELAYOUT, (_T("%s: Fn key is now %s\r\n"),pszFname, (fFnDown ? _T("DOWN") : _T("UP"))));

    RETAILMSG(RAP,(_T("%s: Fn key is now %s\r\n"),pszFname, (fFnDown ? _T("DOWN") : _T("UP"))));

            }

            else

            {

                // We have one key event

                ++cRmpKbdEvents;

     

                if (fKeyDown)

                {

                    // Handle key down

    //RETAILMSG(1,(TEXT("fKeyDown\r\n")));

                    if (fFnDown)

                    {

                        // Fn key is on

    //RETAILMSG(1,(TEXT("fFnDown\r\n")));

                        if (IS_NUMLOCK_ON(pKbdEventCurr->KeyStateFlags))

                        {

                            pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapNumLock, dim(g_rgvkMapNumLock));

                        }

     

                        if (pvkMap == NULL)

                        {

                            // NumLock did not effect this key. See if the

                            // Fn key by itself does.                        

                            pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapFn, dim(g_rgvkMapFn));

                        }

                    }

                }

                else

                {

                    // Handle key up

                    if (fFnDown)

                    {

                        // Fn key is on

    RETAILMSG(1,(TEXT("2 ELSE CONDITION\r\n")));

                        if (IS_NUMLOCK_ON(pKbdEventCurr->KeyStateFlags))

                        {

                            pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapNumLock, dim(g_rgvkMapNumLock));

                        }

     

                        if (pvkMap == NULL)

                        {

                            // NumLock did not effect this key. See if the

                            // Fn key by itself does.                        

                            pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapFn, dim(g_rgvkMapFn));

                        }

                    }

                }

     

                if (pvkMap != NULL)

                {

                    // This combination generates a different virtual key

                    DEBUGCHK(pvkMap->uiVkGenerated != 0);

                    pKbdEventRmpCurr->uiVk = pvkMap->uiVkGenerated;

                }

            }

        }

     

        return cRmpKbdEvents;    

    }

     

     

    static DEVICE_LAYOUT dlMatrixEngUs =

    {

        sizeof(DEVICE_LAYOUT),

        MATRIX_PDD,

        rgscvkMatrixEngUSTables,

        dim(rgscvkMatrixEngUSTables),

        MatrixUsRemapVKey,

    };

     

    extern "C"

    BOOL

    Matrix(

        PDEVICE_LAYOUT pDeviceLayout

        )

    {

        DEBUGCHK(pDeviceLayout != NULL);

     

        BOOL fRet = FALSE;

     

    // RETAILMSG(1, (_T("Matrix:-> Inside Matrix Function\r\n")));

    // RETAILMSG(1,(TEXT("BOOL MATRIX\r\n")));

    // RETAILMSG(1,(TEXT("pDeviceLayout->dwSize =%x\r\n"),pDeviceLayout->dwSize));

    // RETAILMSG(1,(TEXT("sizeof(DEVICE_LAYOUT) =%d\r\n"),sizeof(DEVICE_LAYOUT)));

        if (pDeviceLayout->dwSize != sizeof(DEVICE_LAYOUT))

        {

            RETAILMSG(1, (_T("Matrix: data structure size mismatch\r\n")));

            goto leave;

        }

     

        // Make sure that the Sc->Vk tables are the sizes that we expect

        DEBUGCHK(dim(ScanCodeToVKeyTable) == (1 + ScanCodeTableLast - ScanCodeTableFirst));

    DEBUGCHK(dim( ScanCodeToVKeyExtTable) == (1 + ScanCodeTableExtLast - ScanCodeTableExtFirst));

        *pDeviceLayout = dlMatrixEngUs;

     

        fRet = TRUE;

     

    leave:

    RETAILMSG(1, (_T("Matrix:<- Inside Matrix Function\r\n")));

        return fRet;

    }

     

    #ifdef DEBUG

    // Verify function declaration against the typedef.

    static PFN_DEVICE_LAYOUT_ENTRY v_pfnDeviceLayout = Matrix;

    #endif

    ....

     

     

    sorry for group members... i know this is very hard to understand & i asked same question again & again... still now i did get reply thats why.... sorry....

    kindly reply...

     

     

     

     

    I am confused when passing a unicodes in my array...

     

     

    regards

    Saravanan G

     

    Wednesday, September 1, 2010 10:02 AM
  • Have you considered debugging your code?

    Have you checked to see that the app is using a font that supports the characters?

    Have you tried using a keyboard that has the characters that you are having trouble with to see what they do?

    Have you tried using Remote Spy to check the messages that are being sent to the application?

    Does the key make sense for the layout and language that you have selected?

    And again, since you didn't answer this in one of your many other posts on this topic, does you font support the characters that you are trying to display?

    Also, you do understand that you are working with an input device don't you?  The applciation does the "printing" or "Display".


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Wednesday, September 1, 2010 7:22 PM
    Moderator