eMbedded Visual C++ for Windows CE - GetKeyNameText error

I'm trying to work with Windows CE. I know C programming, but Microsoft pretty much has you locked down to using their eMbedded Visual C++ program and the Windows language.

I'm trying to translate the HexCodes of a key press into regular key names, and I'm using GetKeyNameText, but the program won't compile. I'm getting the following error:

Keytrac.c(230) : warning C4013: 'GetKeyNameText' undefined; assuming extern returning int

Keytrac.obj : error LNK2019: unresolved external symbol _GetKeyNameText@12 referenced in function _DoPaintMain@16
X86EMDbg/Keytrac.exe : fatal error LNK1120: 1 unresolved externals


The code snippet is below:

LRESULT DoPaintMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                     LPARAM lParam) {
    PAINTSTRUCT ps;
    RECT rect, rectOut;
    TCHAR szOut[256];
    HDC hdc;
    INT i, j;
    LPCTSTR pKeyText;
    LPCTSTR szKeyName;

    GetClientRect (hWnd, &rect);
    rect.top += CommandBar_Height (GetDlgItem (hWnd, IDC_CMDBAR));

    rectOut = rect;
    rectOut.bottom = rectOut.top + nFontHeight;
    hdc = BeginPaint (hWnd, &ps);
    if(bFirst == 0) {
     DrawText (hdc, TEXT (" Proven Cylinder Tracking\n Please enter option number."), -1, &rect, DT_LEFT | DT_TOP);
    }
   
    if (nKeyCnt) {
        for (i = 0; i < nKeyCnt; i++) {
         wsprintf (szOut, TEXT ("wP:%08x lP:%08x shift: %s"),
            ka[i].wParam, ka[i].lParam, ka[i].szShift);
            //GetKeyNameText
            GetKeyNameText(ka[i].lParam, szKeyName, lstrlen(szKeyName) / sizeof(TCHAR));
               
            for (j = 0; j < dim (knArray); j++)
                if (knArray[j].wMsg == ka[i].wKeyMsg)
                    break;
            if (j < dim (knArray))
                pKeyText = knArray[j].pName;
            else
                pKeyText = TEXT ("Unknown");    

            // Scroll the window one line
            ScrollDC (hdc, 0, nFontHeight, &rect, &rect, NULL, NULL);

            ExtTextOut (hdc, 10, rect.top, ETO_OPAQUE, &rectOut,
            szOut, lstrlen (szOut), NULL);

                // Scroll the window another line
            ScrollDC(hdc, 0, nFontHeight, &rect, &rect, NULL, NULL);
            ExtTextOut (hdc, 5, rect.top, ETO_OPAQUE, &rectOut,
                            pKeyText, lstrlen (pKeyText), NULL);
           
        }
        nKeyCnt = 0;
         bFirst = 1;
    }
    EndPaint (hWnd, &ps);
    return 0;
}


Any help would be appreciated.

thanks,

madghoulAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>>I'm trying to work with Windows CE.

See the docs on 'GetKeyNameText()':

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported. <-----!!!!
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

0
 
madghoulAuthor Commented:
So does anyone know how I would go about getting the actual key name pressed under Windows CE?
0
 
bcladdCommented:
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to jkr: Grade B

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
jkrCommented:
Hum, why 'Grade B'? Is there anything that could be improved?
0
 
bcladdCommented:
It seemed that the original poster's follow-up question warranted consideration.

-bcl
0
 
jkrCommented:
OK, I agree. Thank you for responding.
0
All Courses

From novice to tech pro — start learning today.