Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

windows-ce

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 and be in the taskbar.

another question is, when i have an external program that has a Textbox, how

to make that when i press any key in my C# keyboard it will be in this external Textbox ?

thank's in advance

like image 234
Gold Avatar asked Oct 04 '10 08:10

Gold


2 Answers

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.

like image 83
ctacke Avatar answered Sep 20 '22 00:09

ctacke


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

like image 39
Michael Eakins Avatar answered Sep 19 '22 00:09

Michael Eakins