how to make program that be in the taskbar windows-CE

后端 未结 2 751
旧时难觅i
旧时难觅i 2021-01-18 09:05

how to make C# program that will be All time in the taskbar ?

i want to Build a Keyboard program.

i need that when i open the device the program will open an

相关标签:
2条回答
  • 2021-01-18 09:50

    To Create a system Tray application in Windows-CE, put some code like:

    CSystemTray m_TrayIcon;   // Member variable of some class
    
    ... 
    // in some member function maybe...
    
    m_TrayIcon.Create(pParentWnd, WM_MY_NOTIFY, "Click here", 
                      hIcon, nTrayIconID);
    

    Eg. For a non-MFC tray icon, do the following:

    Collapse
    CSystemTray m_TrayIcon;   // Member variable of some class
    
    ... 
    // in some member function maybe...
    
    m_TrayIcon.Create(hInstance, NULL, WM_MY_NOTIFY, 
                      "Click here", hIcon, nID);
    
    // Send all menu messages to hMyMainWindow
    
    m_TrayIcon.SetTargetWnd(hMyMainWindow);
    

    As found here:

    http://www.codeproject.com/KB/shell/systemtray.aspx

    To create a system tray application in Windows XP or Windows 7/Vista, put some code like this in your project:

    private void Form1_Resize(object sender, System.EventArgs e)
    {
       if (FormWindowState.Minimized == WindowState)
          Hide();
    }
    

    and this to handle the system tray click

    private void notifyIcon1_DoubleClick(object sender,
                                         System.EventArgs e)
    {
        Show();
        WindowState = FormWindowState.Normal;
    }
    

    This and more information found at :

    http://www.developer.com/net/net/article.php/3336751/C-Tip-Placing-Your-C-Application-in-the-System-Tray.htm

    0 讨论(0)
  • 2021-01-18 10:00

    It's not implemented in the CF, but the NotifyIcon class is what you're after. The SDF does implement it. It would be used something like this:

    m_notifyIcon = new NotifyIcon();
    m_notifyIcon.Icon = this.Icon;
    m_notifyIcon.Visible = true;
    m_notifyIcon.Click += new EventHandler(m_notifyIcon_Click);
    m_notifyIcon.DoubleClick += new EventHandler(m_notifyIcon_DoubleClick);
    

    EDIT

    If you want to implement this yourself, the place to start is with the Shell_NotifyIcon API. You'll want to pass it the handle to a MessageWindow class and handle the WM_NOTIFY messages.

    0 讨论(0)
提交回复
热议问题