locked
Todays Screen in windows devices RRS feed

  • Question

  • Is there any way by which I can get all values associated with my key pressed e.g when user press 2 .. is it possible to get 2,a,b,c in multitab phone.

    How is this acheived in todays screen of  windows mobile devices . Or how is this acheived in case u want search any contact on uor device . say if u press 2 then 2 is gets typed and contact with letter A gets highlighted.

    Regards,  

     


    winningbrew
    Wednesday, April 8, 2009 3:24 AM

All replies

  • Hi Brewwindow,

    If you want to place an icon on your today screen bottom.

    public

     

    class NotifyIcon

    {

     

    //Declare click event

     

    public event System.EventHandler Click;

     

    private WindowSink windowSink;

     

    private int uID = 5000;

     

    //Constructor

     

    public NotifyIcon()

    {

     

    //Create instance of the MessageWindow subclass

    windowSink =

    new WindowSink(this);

    windowSink.uID = uID;

    }

     

    //Destructor

    ~NotifyIcon()

    {

    Remove();

    }

     

     

    public void Add(IntPtr hIcon)

    {

    TrayMessage(windowSink.Hwnd, NIM_ADD, (

    uint)uID, hIcon);

    }

     

    public void Remove()

    {

    TrayMessage(windowSink.Hwnd, NIM_DELETE, (

    uint)uID, IntPtr.Zero);

    }

     

    public void Modify(IntPtr hIcon)

    {

    TrayMessage(windowSink.Hwnd, NIM_MODIFY, (

    uint)uID, hIcon);

    }

     

     

     

    private void TrayMessage(IntPtr hwnd, int dwMessage, uint uID, IntPtr hIcon)

    {

     

    NOTIFYICONDATA notdata = new NOTIFYICONDATA();

    notdata.cbSize = 152;

    notdata.hIcon = hIcon;

    notdata.hWnd = hwnd;

    notdata.uCallbackMessage = WM_NOTIFY_TRAY;

    notdata.uFlags = NIF_MESSAGE | NIF_ICON;

    notdata.uID = uID;

     

    int ret = Shell_NotifyIcon(dwMessage, ref notdata);

    }

    #region

     

    API Declarations

     

    internal const int WM_LBUTTONDOWN = 0x0201;

     

    //User defined message

     

    internal const int WM_NOTIFY_TRAY = 0x0400 + 2001;

     

    internal const int NIM_ADD = 0x00000000;

     

    internal const int NIM_MODIFY = 0x00000001;

     

    internal const int NIM_DELETE = 0x00000002;

     

    const int NIF_MESSAGE = 0x00000001;

     

    const int NIF_ICON = 0x00000002;

     

     

    internal struct NOTIFYICONDATA

    {

     

    internal int cbSize;

     

    internal IntPtr hWnd;

     

    internal uint uID;

     

    internal uint uFlags;

     

    internal uint uCallbackMessage;

     

    internal IntPtr hIcon;

     

    //internal char[] szTip = new char[64];

     

    //internal IntPtr szTip;

    }

    [

    DllImport("coredll.dll")]

     

    internal static extern int Shell_NotifyIcon(

     

    int dwMessage, ref NOTIFYICONDATA pnid);

    [

    DllImport("coredll.dll")]

     

    internal static extern int SetForegroundWindow(IntPtr hWnd);

    [

    DllImport("coredll.dll")]

     

    internal static extern int ShowWindow(

     

    IntPtr hWnd,

     

    int nCmdShow);

    [

    DllImport("coredll.dll")]

     

    internal static extern IntPtr GetFocus();

    #endregion

     

    #region

     

    WindowSink

     

    internal class WindowSink : Microsoft.WindowsCE.Forms.MessageWindow

    {

     

    //Private members

     

    private int m_uID = 0;

     

    private NotifyIcon notifyIcon;

     

    //Constructor

     

    public WindowSink(NotifyIcon notIcon)

    {

    notifyIcon = notIcon;

    }

     

    public int uID

    {

     

    set

    {

    m_uID =

    value;

    }

    }

     

    protected override void WndProc(ref Microsoft.WindowsCE.Forms.Message msg)

    {

     

    if (msg.Msg == WM_NOTIFY_TRAY)

    {

     

    if ((int)msg.LParam == WM_LBUTTONDOWN)

    {

     

    if ((int)msg.WParam == m_uID)

    {

     

    //If somebody hooked, raise the event

     

    if (notifyIcon.Click != null)

    notifyIcon.Click(notifyIcon,

    null);

    }

    }

    }

    }

    }

    #endregion

    }


    It just ads icon on today screen.


    Coming to the handling key events, you can follow this link

    If this does not give you solution, please explain your requirement more clearly.


    Regards,
    Malleswar



    Wednesday, April 8, 2009 7:31 AM
  • Hi,

         Actually I don't want to put my application icon on todays window . I was just trying to give example ... but lets leave it for now .

        But actually I wanted to say was... I need to know wt are the associated keys  to the the key which  is pressed . if it's not possible how is this thing achieved in

      e.g  ... in any device if u open contacts window n press any key say 2 then 2 gets printed on top while all contacts with letter a,b,c gets selected . That means     somehow developer of that application know that with key 2 .. a,b,c are associated.

    Thats wt I want to achieve... to know wt are the associated keys with one key tht  is pressed


    Regards,

    winningbrew
    Tuesday, April 14, 2009 4:26 AM
  • Hi Brewwindow,


    I already gave the link for handling the key events,

    you can follow this link


    By using that key events you can use your logic.


    Regards,
    Malleswar
    Tuesday, April 14, 2009 7:54 AM
  • I am afraid tht , this link leads me nowhere near the  solution  .  I need to know wt are the associated keys  to the the key which  is pressed eg I need to know if 2 is pressed a,b,c are the other keys which are mapped to key 2 in this particular device (since keys are mapped differently in different phones in qwerty mode). 
    winningbrew
    Wednesday, April 15, 2009 6:04 AM