⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.wzd

📁 《vc++扩展编程实例》源码。运用Visual C++ 5.0或6.0的高级编程技巧
💻 WZD
字号:
/////////////////////////////////////////////////////////////////////
// Modify any class that can receive a windows message.
/////////////////////////////////////////////////////////////////////


// 1) define a new window message to indicate user has clicked on icon 
//  in system tray
#define WM_SYSTEMTRAY WM_USER+1

// 2) add a message handler for this new message to the message map
// (also define it in this class's include file)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	:	:	:
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_SYSTEMTRAY,OnSystemTray)

// 2) to put an icon in the system tray
    NOTIFYICONDATA nid;
	nid.cbSize = sizeof(NOTIFYICONDATA);
	nid.hWnd = m_hWnd;									 // handle of window that will receive messages from icon
	nid.uID=ID_SYSTEMTRAY; 								 // id for this icon
	nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;			 // the next three parameters are valid
	nid.uCallbackMessage=WM_SYSTEMTRAY;					 // message that icon sends when clicked
	nid.hIcon=AfxGetApp()->LoadIcon(IDI_SYSTEMTRAY_ICON);// icon
    strcpy(nid.szTip,"System Tray Tip");				 // bubble help message for icon
	::Shell_NotifyIcon(NIM_ADD,&nid);


// 3) to delete an icon from the system tray
    NOTIFYICONDATA nid;
	nid.cbSize = sizeof(NOTIFYICONDATA);
	nid.hWnd = m_hWnd;
	nid.uID=ID_SYSTEMTRAY; 
	nid.uFlags=0;
	::Shell_NotifyIcon(NIM_DELETE,&nid);


// to handle a system tray icon message
LRESULT CMainFrame::OnSystemTray(WPARAM wParam,LPARAM lParam)
{
	// wParam = the nid.uID defined above (useful if you have more then one icon in tray)
	// lParam = mouse message
	if (wParam==ID_SYSTEMTRAY)
	{
		switch (lParam)
		{
		case WM_LBUTTONDOWN:
			break;

		case WM_RBUTTONDOWN:
			break;

		case WM_LBUTTONDBLCLK:
			break;

		}
	}
	return 1;
}


/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -