?
Solved

eMbedded Visual C++ for Windows CE - GetKeyNameText error

Posted on 2003-02-26
6
Medium Priority
?
432 Views
Last Modified: 2010-08-05
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,

0
Comment
Question by:madghoul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
ID: 8025848
>>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
 

Author Comment

by:madghoul
ID: 8027146
So does anyone know how I would go about getting the actual key name pressed under Windows CE?
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9846922
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:jkr
ID: 9852392
Hum, why 'Grade B'? Is there anything that could be improved?
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9852469
It seemed that the original poster's follow-up question warranted consideration.

-bcl
0
 
LVL 86

Expert Comment

by:jkr
ID: 9852483
OK, I agree. Thank you for responding.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question