Re: GetKeyState() problem
From: Jim Merkle (jimmerkle_at_hotmail.com)
Date: 02/10/04
- Next message: Robert Magyar: "Re: Is there a way to boost MediaPlayer's playback thread priority"
- Previous message: John Flynn: "Connecting to a Local Image"
- In reply to: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Next in thread: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Reply: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 13:33:00 -0800
I don't want to know the state of the key. I want to know the state of the
flags, especially for the toggle keys. The following is from the on-line
help:
For Windows CE versions 1.0 through 2.01, GetKeyState is used to check the
toggled state of the VK_CAPITAL virtual key only. For Windows CE versions
2.10 and later, the toggle state of the VK_NUMLOCK virtual key can also be
checked.
The API, GetAsynchKeyState(), does not provide toggle state information. I
changed my test program to use GetAsyncKeyState(). The Shift, Control, and
Alt key functions worked great. GetAsynchKeyState() does not return toggle
information.
Does the program that I initially supplied work on your unit to show the
toggle state for VK_CAPITAL with your unit? It no longer works on mine....
Jim
"Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in
message news:eTmMrDB8DHA.452@TK2MSFTNGP11.phx.gbl...
> No, no layout manager stuff.
>
> I don't have any idea whether it changed or not. The documentation has, I
> believe, always indicated that GetAsynchKeyState() was the right way to
find
> out the key state at this very instant. Maybe the layout manager stuff
gave
> MS a push to make it actually work that way.
>
> Paul T.
>
> "Jim Merkle" <jimmerkle@hotmail.com> wrote in message
> news:eCS8HtA8DHA.1804@TK2MSFTNGP12.phx.gbl...
> > I've used GetKeyState() in CE2.12, CE3.0, and now in 4.2. In all
> previous
> > versions of CE, it would return the input system's current keyboard flag
> > values.
> >
> > My matrix keyboard does not export any of the Layout Manager Interfaces.
> > (MatrixKB.def) Does your keyboard driver export additional Layout
Manager
> > Interfaces defined in the keyboard's def file?
> >
> > LayoutMgrGetKeyboardType
> > LayoutMgrGetKeyboardLayout
> > LayoutMgrGetKeyboardLayoutName
> > LayoutMgrGetKeyboardLayoutList
> > LayoutMgrLoadKeyboardLayout
> > LayoutMgrActivateKeyboardLayout
> > IL_00000409
> > PS2_AT_00000409
> >
> >
> > In previous versions of CE, any thread could call this API to determine
> the
> > input system's understanding of these modifier flags.
> >
> > Did this API change scope, or is this Layout Manager layer somehow
> involved?
> > Adding the Layout Manager Layer is a fairly invasive task.
> >
> > Thanks,
> >
> > Jim
> >
> > "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in
> > message news:uF6yfC27DHA.3288@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > >
> > > Well, our device and its driver seem to be doing the right thing. Are
> you
> > > sure that GetKeyState() and not GetAsyncKeyState() is what you want
> there?
> > > I think that, based on how you're trying to use GetKeyState() it won't
> > work.
> > > If you read the help in eVC 4 on GetKeyState() you'll see that its
> return
> > > value is based on the current state, as far as the message pump for
the
> > > current thread knows, and you aren't running a message pump there.
> > >
> > > Paul T.
> > >
> > > "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote
in
> > > message news:OApGC517DHA.2644@TK2MSFTNGP11.phx.gbl...
> > > > Jim,
> > > >
> > > > Hmmm. Well, I don't think that they are required, no. Our driver
> > doesn't
> > > > conform either, right now. Let me try some GetKeyState() tests and
> see
> > > what
> > > > I see.
> > > >
> > > > Paul T.
> > > >
> > > > "Jim Merkle" <jimmerkle@hotmail.com> wrote in message
> > > > news:%23SjVqf17DHA.2432@TK2MSFTNGP10.phx.gbl...
> > > > > The source you are referring to is nk\kernel\kmisc.c,
> > SC_GetKeyState().
> > > > > That is the kernel's method of accessing this function.
Coredll.dll
> > > > > provides access to this function as well (ordinal 860).
> > > > >
> > > > > Since none of the keyboard drivers export anything like this
> function,
> > > it
> > > > > isn't part of a keyboard driver, and is contained in another
module.
> > > > >
> > > > > Since my keyboard driver doesn't conform to the Layout Manager
> > > Interface,
> > > > I
> > > > > was wondering if that had anything to do with it...? Are the
Layout
> > > > Manager
> > > > > Interface routines requires as of 4.2?
> > > > >
> > > > >
> > > > > Jim
> > > > >
> > > > >
> > > > >
> > > > > "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com>
wrote
> > in
> > > > > message news:eLj9xl07DHA.2712@tk2msftngp13.phx.gbl...
> > > > > > The source for GetKeyState() is in the private source code that
> > ships
> > > > with
> > > > > > PB4.2. It appears to me that the MID_GetKeyState entry in an
> array
> > of
> > > > > > keyboard driver functions is being called with the virtual key
> code
> > > > passed
> > > > > > to it as a parameter...
> > > > > >
> > > > > > Paul T.
> > > > > >
> > > > > >
> > > > > > "Jim Merkle" <jimmerkle@hotmail.com> wrote in message
> > > > > > news:%23Vic3g07DHA.2832@tk2msftngp13.phx.gbl...
> > > > > > > Using Windows CE.NET 4.2, with a Matrix Keyboard Driver.
> > > > > > >
> > > > > > > The keyboard driver is sending the appropriate VK codes to the
> > input
> > > > > > system
> > > > > > > in that the Alt key does produce the menus on the CMD or
Pocket
> > Word
> > > > > > > applications.
> > > > > > >
> > > > > > > Does 4.2 route the GetKeyState() though new Keyboard APIs that
> I'm
> > > not
> > > > > > > exposing?
> > > > > > >
> > > > > > > Jim M.
> > > > > > >
> > > > > > >
> > > > > > > "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com>
> > wrote
> > > > in
> > > > > > > message news:%23Mg6HQ07DHA.2676@TK2MSFTNGP10.phx.gbl...
> > > > > > > > What kind of device and what version of the OS is this
running
> > on?
> > > > > > > >
> > > > > > > > Paul T.
> > > > > > > >
> > > > > > > > "Jim Merkle" <jimmerkle@hotmail.com> wrote in message
> > > > > > > > news:On%23mkK07DHA.1428@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > It seems I can't read the state of my Alt, Control, or
Shift
> > > > > flags....
> > > > > > > > >
> > > > > > > > > The following code was generated to return the status of
> these
> > > > > flags:
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
//--------------------------------------------------------------------------
> > > > > > > > > --------
> > > > > > > > > int WINAPI WinMain( HINSTANCE hInstance,
> > > > > > > > > HINSTANCE hPrevInstance,
> > > > > > > > > LPTSTR lpCmdLine,
> > > > > > > > > int nCmdShow)
> > > > > > > > > {
> > > > > > > > > for(int i=0;i<400;i++)
> > > > > > > > > {
> > > > > > > > >
> > > > > > > > > SHORT sControl = GetKeyState(VK_CONTROL);
> > > > > > > > > RETAILMSG(1,(L"sControl: 0x%X\r\n",sControl));
> > > > > > > > >
> > > > > > > > > SHORT sShift = GetKeyState(VK_SHIFT);
> > > > > > > > > RETAILMSG(1,(L"sShift: 0x%X\r\n",sShift));
> > > > > > > > >
> > > > > > > > > SHORT sAlt = GetKeyState(VK_MENU);
> > > > > > > > > RETAILMSG(1,(L"sAlt: 0x%X\r\n",sAlt));
> > > > > > > > >
> > > > > > > > > SHORT sCaps = GetKeyState(VK_CAPITAL);
> > > > > > > > > RETAILMSG(1,(L"sCaps: 0x%X\r\n",sCaps));
> > > > > > > > >
> > > > > > > > > Sleep(800);
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > return 0;
> > > > > > > > > } // WinMain
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
//--------------------------------------------------------------------------
> > > > > > > > > --------
> > > > > > > > >
> > > > > > > > > The debug messages only return 0x0 regardless of the state
> of
> > > the
> > > > > > input
> > > > > > > > > system "flags".
> > > > > > > > >
> > > > > > > > > If you have any ideas, please let me know...
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > > > >
> > > > > > > > > Jim Merkle
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Robert Magyar: "Re: Is there a way to boost MediaPlayer's playback thread priority"
- Previous message: John Flynn: "Connecting to a Local Image"
- In reply to: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Next in thread: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Reply: Paul G. Tobey [eMVP]: "Re: GetKeyState() problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|