程序开始运行,只在Systray中显示一个ICON,没有任何的对话框和界面,当在ICON上点击鼠标是,显示一个菜单。如何实现这个菜单,以及相关的消息映射?(程序是有MFC对话框程序改变的,即在对话框显示之前实现菜单和ICON)。

解决方案 »

  1.   

    这个很容易。
    对话框可以showWindow(SW_HIDE)嘛!
    只向Systray那儿加个图标。处理它的菜单。留下邮箱,我给你发一个例子程序得了
    或者直接跟[email protected]要。注明事项。
      

  2.   

    参考相关MSDN资料Shell_NotifyIcon
    This function sends a message to the system to add, modify, or delete an icon from the taskbar status area.WINSHELLAPI BOOL WINAPI Shell_NotifyIcon(
    DWORD dwMessage, 
    PNOTIFYICONDATA pnid );
    Parameters
    dwMessage 
    [in] Specifies the message value to send. It is one of these values: 
    Value Description 
    NIM_ADD Adds an icon to the status area. 
    NIM_DELETE Deletes an icon from the status area. 
    NIM_MODIFY Modifies an icon in the status area. pnid 
    [in] Pointer to a NOTIFYICONDATA structure. The content of the structure depends on the value of dwMessage. 
    Return Values
    Nonzero indicates success. Zero indicates failure.
    然后自己做上一遍,就全都记住了
      

  3.   

    可能我没说清楚,我的意思是我不要那个窗口,即不要 int nResponse=dlg.DoModal();这一行,因为平时运行不需要这个对话框啊,只需要在systray里显示一个图标就可以了,不知道这样能不能实现。