手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>程序设计>C/C++>列表

用c#实现智能设备上的notifyicon类 _c#应用

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!


internal struct NOTIFYICONDATA
{
internal int cbSize;
internal IntPtr hWnd;
internal uint uID;
internal uint uFlags;
internal uint uCallbackMessage;
internal IntPtr hIcon;
}

[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();

[DllImport("coredll.dll")]
internal static extern IntPtr LoadIcon(IntPtr hInst, string IconName);

[DllImport("coredll.dll")]
internal static extern IntPtr GetModuleHandle(String lpModuleName);


#endregion


MessageWindow#region MessageWindow

internal class MyMessageWindow : Microsoft.WindowsCE.Forms.MessageWindow
{

private int _uID = 0;
private NotifyIcon notifyIcon;


public MyMessageWindow(NotifyIcon notIcon)
{
notifyIcon = notIcon;
}

public int uID
{
set
{
_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 == _uID)
{

if (notifyIcon.Click != null)
notifyIcon.Click(notifyIcon, null);

}
}
}

}
}
#endregion

}
}
http://www.cnblogs.com/ttinfo/archive/2006/10/31/545741.html


文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!