Funktion Key Blue and Orange, SHIFT, ALT and CTRL

This question is not answered

Hi,

we are running an app, which hides the taskbar (where the clock shows).

In case the user presses one of the modifier keys (Bluekey,Orangekey, SHIFT, ALT,CTR) the symbol which shows the keyboard state isn't visible also.


With WAP G1 this keyboard state symbol showed up on top of all windows, so this was visible even without the taskbar.

How can this be managed? Any ideas are very welcome. Examples how to solve programmatically (VS2008, C#) also.


Regards

Tamer

All Replies
  • Good afternoon Tamer,

    May I bring this post to your attention as it illustrates

    • how to sense / set the modifier key states and
    • get notified as any of the modifier key state changes

    I do hope this helps.
    Kind regards,

    Jacques

  • Hi Jacques, thanks for helping.

    Short, some info: VS2003, MDSDK2.02


    I tried to port you example to my IDE and did following minimal example for testing:


    using PsionTeklogix.Keyboard;
    ...
    public Form1(string[] args)
            {
                InitializeComponent();

                Keyboard.ModifierKeyEvent += new ModifierKeyHandler(Keyboard_ModifierKeyEvent);
                Keyboard_ModifierKeyEvent(null, null);
            }

    ...
    private void Keyboard_ModifierKeyEvent(object sender, ModifierKeyEventArgs eventArgs)
            {
        MessageBox.Show("Pressed");
            }



    I would expact it shows up "Pressed" when ever I press one of the modifiers, but it only show up once,
    while its at line:

                Keyboard_ModifierKeyEvent(null, null);

    What's my fault?

    Tamer

  • VS2008 C# - MDSDK v8.0 - Listen To Modifier Keys [DEMO] Solution for Windows CE.zip

    Tamer,

    The issue is probably due to the fact you are using an obsolete version of our Mobile Devices SDK.

    The below matrix lists the recommended SDK versions depending on the targeted device:

    Mobile Device SDK VS Targeted platform 

     

    MDSDK v5.4

    MDSDK v6.0

    MDSDK v8.0

    WAP4

    l

    l

    ü

    VH10

    l

    ü

    û

    All other Psion devices:
    CE 5.0, CE 6.0, WM 6.x and/or WEH

    ü

    l

    û

    Legend 

    ü Recommended
    l Supported (should work as expected)
    û Not recommended / supported

    --

    As depicted below, while using the attached C# program - which references MDSDK v8.0 - I indeed received notifications as modifier keys were pressed.

    --

    I do hope this helps.

    Kind regards,
    Jacques

  • Jacques,

    thanks for this example. May I ask you in this regard:

    1. Idea:

    Is it possible to write a second app, which runs and waits in back, while the first app is executed. If a modifier key is pressed it stepps for 1 sec. to the front and hides back again. Can this be done with your example? Or does the app in back don't receive key strokes of the modifiers?

    2. Idea:

    Is it better to remap the modifier keys so they additionally call this second app? If yes how can this be done?

    3. Idea:

    Is there a way (peeks and pokes) to set the "modifier square" again infront of all? I recognised that this is showing up at the taskbar over the loudspeaker sign, so as if it appears on top of all the taskbar.

    Regards,

    Tamer

  • Our solution:
    With the source, Jacques brought we created an app, which only restores the off state of all the modifiers (Blue, Orange, ALT, Shift, CTRL) with VS2008, CF2.0. Whenever this app is started, it turns all modifiers off and quits.


    Background:
    Given is an old VS2003, CF1.0 app, which was running on G1, now has to be ported to G4. The modifier key problem (as described top) has to be solved. As the new MDSDK V5.4 doesn't work with VS2003, CF1.0 we choos this workarround. The old app is calling the new app by some events, to restore the state of the modifiers to a defined state.

    In case the user gets messed up with the state of the modifiers, he knows after this event it will be restored. Hope this will do the job.

    I will leave the discussion open, in case a better sollution can be found.

    Thank you, cheers.

    Tamer

  • Shift-State Indicator and Shutdown Shift-State Indicator [WM 6.x executable].zip

    Tamer,

    If interested, feel free to give the attached executable a try.

    Upon execution, the Shift-State Indicator.exe program will bring up the following Indicator (a TOP_MOST window) to the top left corner of your screen [1] 

    --

    [1] Clicking the indicator will make it jump - clockwise - around your screen.

    As you already guessed, the Shutdown Shift-State Indicator.exe program will simply close the Shift-State Indicator.exe program.

    I do hope this helps.
    Kind regards,

    Jacques

  • Jacques,

    this is great. Txl.

    Just a very little improvement, if you don't mind:

    It starts top left corner. When the taskbar is visible it stays invisible, because the taskbar shows on top of it. The start up corner should be "down right", because of two advantages:

    1. after starting, while taskbar is visible for some reason, it is not visible at first

    2. the former indicator was also at "down right", where the old users where used to have it.


    Any way exelect job! Again txl.

    Tamer

  • Shift-State Indicator and Shutdown Shift-State Indicator [WM 6.x executable] - 2017-APR-03.zip

    Tamer,

    You will find attached to this note a newer version of the executable files I shared with you last week.

    The Shift-State Indicator.exe program can now take optional arguments.

    Syntax goes as follows:

    Shift-State Indicator [0|1|2|3] [autohide]

    where

    0 : initially brings up the Indicator to the top-left corner
    1 : initially brings up the Indicator to the top-right corner
    2 : initially brings up the Indicator to the bottom-right corner
    3 : initially brings up the Indicator to the bottom-left corner

        ┌─────────────────┐
        │ 0             1 │
        │                 │
        │                 │
        │                 │
        │                 │
        │                 │
        │                 │
        │                 │
        │ 3             2 │
        └─────────────────┘

    autohide : will hide the indicator if no modifier key is 'on'
              (this optional argument is not case sensitive)

    & If no argument is passed, the indicator will initially be displayed to the top-left corner of your screen and will NOT autohide

    I do hope this helps.

    MfG
    Jacques

  • Jacques,

    sorry for roling in again, but our testing showed up a major problem. The indicator app catches the focus, so the user has to tap his application to go on with it.


    Example:

    Our application consist of many forms. One main form, which shows other forms with listboxes.

    So, after the listbox-form closes, the focus don't return to the main form, rather it stucks on the indicator. You have to tap on the main form to go on.

    Regards

    Tamer

    Note: While I was writing this, you delivered the second Version. I will give it tomorrow a try.

  • VS2008 C# BasicApp [DEMO] Solution.zip

    Tamer
    So, after the listbox-form closes, the focus don't return to the main form, rather it stucks on the indicator. You have to tap on the main form to go on.

    Food for thought:
    Would adding the below highlighted statement help?

    void btnLoadForm2_Click(object sender, EventArgs e)
    {
        Form2 f = new Form2();
        f.ShowDialog();
        f.Dispose();
        this.Activate();
    }

    FYI: I used the attached trivial C# solution to conduct tests.

    E.g.

    Upon startup, I landed on this Form

    At this point, I clicked the [ Load Form2 ] button to load the below form and pressed the [ Shift ] key modifier twice to lock it:

    I then clicked the [ Close ] button to return to the Main Form

    At this point the [ Load Form2 ] button automatically regained focus.

    Finally, as I pressed the down arrow key, the focus moved to the [ Exit ] control

    MfG
    Jacques

  • Hi Jacques,

    VS2003, CF1.1 does not know:    "this.Activate();"

    But, it seams, this did the trick.

    CODE:
    [DllImport("coredll.dll", EntryPoint="FindWindow")]
    public static extern int FindWindow(string lpClassName, string lpWindowName);

    [DllImport("coredll.dll")]
    public static extern bool SetForegroundWindow(IntPtr hwnd);

    // Bring Form to Foreground on Screen

    public static void Activate()

    {
    IntPtr hwnd = (IntPtr) FindWindow("#NETCF_AGL_BASE_", this.Text.ToString());
    SetForegroundWindow(hwnd);

    }

    Exelent job, thanks.

    Tamer

    PS:

    I have two more question running, but no one gets back :-(