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

📄 taskbarmsgwnd.h

📁 vc++6.0开发网络典型应用实例导航 1. 本光盘提供了本书中所有的实例源程序文件。 2. 附录文件夹下是Winsock 函数参考以及错误码列表
💻 H
字号:
#ifndef _TASKBARMSGWND_H
#define _TASKBARMSGWND_H


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


const int IDT_POP_WINDOW_TIMER       = 100;
const int IDT_COLLAPSE_WINDOW_TIMER  = 101;
const int IDT_SHOW_WINDOW_TIMER      = 102;

const int STP_BOTTOM = 200;
const int STP_TOP    = 201;
const int STP_RIGHT  = 202;
const int STP_LEFT   = 203;

class CContactView;
class CContact;

class CTaskBarMsgWnd : public CFrameWnd
{
    DECLARE_MESSAGE_MAP()

public:

    //	CTaskBarMsgWnd(); // No default constructor, sorry!!, use CreateObject then only
                            // use this class

    // Create the message box using this function, as we want to force heap creation
    // Don't use delete to destroy the window, OnTimer() does it automatically.
    static CTaskBarMsgWnd* CreateObject(
                                    CString strMsg,
                                    unsigned int nWndWidth,
                                    unsigned int nWndHeight, 
                                    unsigned int nMsgTimeOut,         
                                    unsigned int nMsgWndCreationDelay, 
                                    CRect rectMsgRect,
                                    COLORREF clrBox,
                                    COLORREF clrText,
									CContactView *ContactView,
									CContact *With,
									CTaskBarMsgWnd *pLast
                              );

                                    
    void PopMsg();  // Interface for actually poping up the message window
    
protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    BOOL OnSetCursor(CWnd* pWnd , UINT nHitTest , UINT message);

	int OnCreate(LPCREATESTRUCT lpCreateStruct);
    
    LRESULT OnMouseHover(WPARAM w, LPARAM l);
    LRESULT OnMouseLeave(WPARAM w, LPARAM l);
	
	//// Added - Matthew Millman ////

	CContactView *View;
	CContact *Contact;
	CTaskBarMsgWnd *Last;
	unsigned int Top;

	/////////////////////////////////
    
    void OnMouseMove(UINT nFlags, CPoint point);
    void OnTimer(UINT nIDEvent);
    void OnSize(unsigned int nType, int cx, int cy);
    void OnDestroy();
    void OnPaint(void);
    void OnLButtonDown(UINT nFlags, CPoint point);

	void Quit();
 
private:

    /* Constructor and destructor private, we want to force heap creation,
       so use CreateObject */

    CTaskBarMsgWnd(
        CString strMsg,
        unsigned int nWndWidth,
        unsigned int nWndHeight, 
        unsigned int MsgTimeOut,         
        unsigned int MsgWndCreationDelay, 
        CRect rectMsgRect,
        COLORREF clrBox,
        COLORREF clrText,
		CContactView *ContactView,
		CContact *With,
		CTaskBarMsgWnd *pLast
    );
    
    ~CTaskBarMsgWnd();  // self destruction in OnTimer, no one should call this function

	HBITMAP bmBack;
	HICON icBack;

	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);

	BOOL CheckIfTaskBarBottom(); // Is Status bar at bottom ?
	BOOL CheckIfTaskBarTop();    // Is Status bar on top ?
	BOOL CheckIfTaskBarRight();  // Is Status bar at right side?
	BOOL CheckIfTaskBarLeft();   // Is Status bar at left side?
	
	void PopWndForBottomTaskBar(); // Pop window when status bar is at bottom
	void PopWndForTopTaskBar();    // Pop window when status bar on top
	void PopWndForRightTaskBar();  // Pop window when status bar is at right side
	void PopWndForLeftTaskBar();   // Pop window when status bar is at left side
	
    unsigned int m_nWndWidth;            // Message window width
	unsigned int m_nWndHeight;           // Mesaage window height
    unsigned int m_nMsgTimeOut;          // Seconds the window remains stationary
    unsigned int m_nMsgWndCreationDelay; // Seconds in which the window gets shown

    unsigned int m_nWndLeft;   // Message window left corner screen coordinates   
    unsigned int m_nWndTop;    // Message window top corner screen coordinates
    unsigned int m_nWndRight;  // Message window right corner screen coordinates
    unsigned int m_nWndBottom; // Message window bottom corner screen coordinates
    unsigned int m_nWndSize;    // Temp variable for storing window size for animation

    unsigned int m_nTaskBarPos; // const about where the status bar.
                                  	
    CString m_strMsg;    // Message to be shown

    CWnd m_wndInvisibleParent; // Invisible parent of this window, this avoids
                               // its appreance in the Taskbar

    CRect m_rectMsgRect; // Rect in which the message will be formatted

    CFont m_fontMessageUnderline;  // Font of the message with underline
    CFont m_fontMessageNoUnderline; // Font of the message without underline
    
    BOOL m_bMouseOverWnd; // Is Mouse over window ?

    HCURSOR m_hCursor; // Cursor when mouse is on window, Hand cursor
    
    COLORREF m_clrBox;  // Colour of the box background
    COLORREF m_clrText; // Colour of the text
};

#endif // _TASKBARMSGWND_H

⌨️ 快捷键说明

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