请问各路高人: 如何像QQ一样将窗口隐藏在屏幕的右下角?

AtCsdn 2002-07-31 01:40:25
如题!
...全文
78 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaotang 2002-07-31
  • 打赏
  • 举报
回复
这是托盘程序也叫任务栏程序
www.vckbase.com
www.vchelp.net
上面都有源程序
AtCsdn 2002-07-31
  • 打赏
  • 举报
回复
请问javanew(我是java新手) ,
你这段代码的.cpp有吗?
lhb_780902 2002-07-31
  • 打赏
  • 举报
回复
NOTIFYICONDATA nid;

nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = ID_TASKBARICON;
nid.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
nid.uCallbackMessage = WM_ICONNOTIFY;
nid.hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, 0);
strcpy(nid.szTip, "定时提醒");
ShowWindow(SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);

WM_ICONNOTIFY为子定义消息,用于处理鼠标点击事件
javanew 2002-07-31
  • 打赏
  • 举报
回复
////////////////////////////////////////////////////////////////////////////
// SystemTray.h : header file
//
// Written by Chris Maunder (chrismaunder@codeguru.com)
// Copyright (c) 1998.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in this file is used in any commercial application
// then acknowledgement must be made to the author of this file
// (in whatever form you wish).
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
//
// Please use and enjoy. Please let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into this
// file.

#ifndef _INCLUDED_SYSTEMTRAY_H_
#define _INCLUDED_SYSTEMTRAY_H_

#include <afxtempl.h>

/////////////////////////////////////////////////////////////////////////////
// CSystemTray window

class CSystemTray : public CWnd
{
// Construction/destruction
public:
CSystemTray();
CSystemTray(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);
virtual ~CSystemTray();

DECLARE_DYNAMIC(CSystemTray)

// Operations
public:
static LRESULT AnimateIconThread(LPVOID pParam);
BOOL Enabled() { return m_bEnabled; }
BOOL Visible() { return !m_bHidden; }

// Create the tray icon
Create(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szTip, HICON icon, UINT uID);

// Change or retrieve the Tooltip text
BOOL SetTooltipText(LPCTSTR pszTooltipText);
BOOL SetTooltipText(UINT nID);
CString GetTooltipText() const;

// Change or retrieve the icon displayed
BOOL SetIcon(HICON hIcon);
BOOL SetIcon(LPCTSTR lpszIconName);
BOOL SetIcon(UINT nIDResource);
BOOL SetStandardIcon(LPCTSTR lpIconName);
BOOL SetStandardIcon(UINT nIDResource);
HICON GetIcon() const;
void HideIcon();
void ShowIcon();
void RemoveIcon();
void MoveToRight();

// For icon animation
BOOL SetIconList(UINT uFirstIconID, UINT uLastIconID);
BOOL SetIconList(HICON* pHIconList, UINT nNumIcons);
BOOL Animate(UINT nDelayMilliSeconds, int nNumSeconds = -1);
BOOL StepAnimation();
BOOL StopAnimation();

// Change menu default item
void GetMenuDefaultItem(UINT& uItem, BOOL& bByPos);
BOOL SetMenuDefaultItem(UINT uItem, BOOL bByPos);

// Change or retrieve the window to send notification messages to
BOOL SetNotificationWnd(CWnd* pNotifyWnd);
CWnd* GetNotificationWnd() const;

// Default handler for tray notification message
virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSystemTray)
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL

// Implementation
protected:
void Initialise();

BOOL m_bEnabled; // does O/S support tray icon?
BOOL m_bHidden; // Has the icon been hidden?
NOTIFYICONDATA m_tnd;

CArray<HICON, HICON> m_IconList;
static UINT m_nIDEvent;
UINT m_uIDTimer;
int m_nCurrentIcon;
COleDateTime m_StartTime;
int m_nAnimationPeriod;
HICON m_hSavedIcon;
UINT m_DefaultMenuItemID;
BOOL m_DefaultMenuItemByPos;

// Generated message map functions
protected:
//{{AFX_MSG(CSystemTray)
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG

DECLARE_MESSAGE_MAP()
private:
HANDLE m_hAnimateThread;
CWnd *m_pParent;
};


#endif

/////////////////////////////////////////////////////////////////////////////

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧