这个函数满足你的愿望!多看看MSDN!
WINSHELLAPI BOOL WINAPI Shell_NotifyIcon(
    DWORD dwMessage, 
    PNOTIFYICONDATA pnid
); Sends a message to the system to add, modify, or delete an icon from the taskbar status area. Returns nonzero if successful, or zero otherwise. 
dwMessage 
Message value to send. This parameter can be one of these values: 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 
Address of a NOTIFYICONDATA structure. The content of the structure depends on the value of dwMessage. 

解决方案 »

  1.   

    不是一显示窗口就隐藏的啊,
    是在点了最小化时,才不在任务拦显示的啊
    用ShowWindow的那个是程序一开始执行就隐藏
    我是说在点了最小化是才不显示在任务拦
      

  2.   

    转贴别人的一个帖子
    在系统任务栏中添加小图标(Shell_NotifyIcon)// 定义消息机制#define WM_NOTIFYICON (WM_APP+100)afx_msg void OnNotifyIcon(WPARAM wParam,LPARAM lParam);ON_MESSAGE(WM_NOTIFYICON,OnNotifyIcon)加入弹出式菜单资源        IDR_POPUP_MENUBOOL CNotifyIconDlg::OnInitDialog(){    ............    // 加入小图标操作    NOTIFYICONDATA tnd;     tnd.cbSize=sizeof(NOTIFYICONDATA);    tnd.hWnd=this->m_hWnd;    tnd.uID=IDR_MAINFRAME;    tnd.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;    tnd.uCallbackMessage=WM_NOTIFYICON;    tnd.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));     strcpy(tnd.szTip,"提示信息");    Shell_NotifyIcon(NIM_ADD,&tnd);    return TRUE;  // return TRUE  unless you set the focus to a control}// 此消息回调函数用于处理弹出式菜单的消息机制void CMy011029D00Dlg::OnNotifyIcon(WPARAM wParam,LPARAM lParam){    UINT uID = (UINT)wParam;    UINT uMouseMsg = (UINT)lParam;    if(uID==IDR_MAINFRAME)    {        CMenu menu;        CPoint pt;        switch(uMouseMsg)        {        case WM_RBUTTONDOWN:            menu.LoadMenu(IDR_POPUP_MENU);            CMenu *pMenu;            pMenu = menu.GetSubMenu(0);            GetCursorPos(&pt);            pMenu->TrackPopupMenu(TPM_RIGHTBUTTON,pt.x,pt.y,this);            break;        case WM_LBUTTONDBLCLK:            ShowWindow(SW_SHOW);            break;        }    }}// 删除小图标操作void CMy011029D00Dlg::OnDestroy() {    CDialog::OnDestroy();    NOTIFYICONDATA nid;    nid.cbSize = sizeof(NOTIFYICONDATA);    nid.hWnd = this->m_hWnd;    nid.uID = IDR_MAINFRAME;    Shell_NotifyIcon(NIM_DELETE,&nid);}// hide dialogvoid CMy011029D00Dlg::OnHide() {    ShowWindow(SW_HIDE);}// display dialogvoid CMy011029D00Dlg::OnDisplay() {    ShowWindow(SW_SHOW);
      

  3.   

    WM_SYSCOMMAND中响应wParam为SC_MINIMIZED的消息在此响应函数中调用ShowWindow
      

  4.   

    问题解决了,谢谢大家
    case WM_SYSCOMMAND:
        switch(LOWORD(wParam))
         {
           case ....
           .........
           .........
           case SC_MINIMIZE:
                Shell_NotifyIcon(NIM_ADD,&nid);
                ShowWindow(hwnd,0);
                return 0;      }