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

📄 frame.h

📁 这是书上的代码
💻 H
字号:

class CZDTray;
class CZDRegistry;

class CZDDeskFrame : public CFrameWnd
{
// Private data
private:
   // Configuration maximums -- max desktops, max size of a desktop name
   enum {MAX_DESKS=9,MAX_NAME=30};

   // TRUE if displaying an item from the menu or the menu itself
   BOOL m_bInMenu;

   // TRUE if in the middle of switching desks
   BOOL m_bSwitching;

   // TRUE when saving a desk's windows, but not actually hiding them
   BOOL m_bNoHide;

   // TRUE if we encounter a locked up application that can't respond to messages
   BOOL m_bFrozen;

   // Window handles of the shell, desktop and any windows ZDDesk is displaying
   HWND m_hWndShell;
   HWND m_hWndDesktop;
   HWND m_hWndPopup;

   // The current active desk
   int m_nCurrDesk;

   // The total number of desktops configured
   int m_nDeskCount;

   // Registry interfaces
   CZDRegistry *m_pRegistry;
   HKEY m_hKey;

   // System tray interface
   CZDTray *m_pTray;

   // Collection classes for desktop information
   CStringArray m_arrStrDeskName;
   CArray<COLORREF,COLORREF> m_arrClrDesk;
   CArray<HWND,HWND> m_arrHwndDesktop[MAX_DESKS];
   CArray<HWND,HWND> m_arrHwndGlued;

// Private operations
private:
   // Sets standard text for a tooltip
   CString GetToolTipText();

   // Displays the context menu
   void ShowContextMenu();

   // Initializes the virtual desktop manager
   void InitializeDesks();

   // Un-initializes the virtual desktop manager
   void UninitializeDesks();

   // Loads the current active desk (based on m_nCurrDesk)
   void LoadDesk(BOOL bSetColors=TRUE);

   // Saves the current active desk (based on m_nCurrDesk)
   void SaveDesk();

   // Switches to the new specified desktop
   void SwitchDesks(int nNewDesk);

   // Adds the specified window to the collection object for the current desk
   void SaveWnd(HWND hWnd);

   // Finds normal or glued windows in their respective collection objects
   int  FindNormalWindow(int nDesk, HWND hWnd);
   int  FindGluedWindow(HWND hWndGlue);

   // Callback routine used by window enumeration
   static BOOL CALLBACK EnumCallback(HWND hWnd, LPARAM lParam);

   // Returns TRUE if the specified window is valid to add to the window collection
   BOOL IsCandidate(HWND hWnd);

   // Returns TRUE if the specified window is glued to all desks
   BOOL IsGlued(HWND hWndGlue) { return FindGluedWindow(hWndGlue) >= 0; }

   // Adds or removes the specifed window to all desks
   void AddToAllDesks(HWND hWnd);
   void RemoveFromAllDesks(HWND hWnd, int nTab);

   // Moves the specified entry from one desk to another
   void MoveToDesk(int nOldDesk, int nOldEntry, int nNewDesk);

   // Glues or unglues the specified window
   void SetGlue(HWND hWndGlue, BOOL bGlue, int nTab);

   // Returns the number of entries in the window collection
   int GetWindowCount(int nDesk);

   // Returns the number of entries in the glued window collection
   int GetGluedCount();

   // Sets the tooltip text for the current desk (based on the desktop name object)
   void SetCurrentToolTip();

   // Performs ShowWindow() for applications that aren't locked up
   BOOL SafeShowWindow(HWND hWnd, int nShowCmd);

   // Performs an safe WM_SYSCOLORCHANGE if no applications are currently locked up
   void SafeSetSysColors(int cElements, CONST INT *lpaElements,
                              CONST COLORREF *lpaRgbValues);

// Construction/destruction
public:
   // Constructor
   CZDDeskFrame();

   // Destructor
   virtual ~CZDDeskFrame();

// Attributes
public:

// Operations
public:

// Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CZDDeskFrame)
   //}}AFX_VIRTUAL

// Generated message map functions
protected:
   //{{AFX_MSG(CZDDeskFrame)
   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
   afx_msg void OnDestroy();
   afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
   afx_msg void OnExit();
   afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
   afx_msg void OnArrange();
   afx_msg void OnProperties();
   afx_msg void OnAbout(); 
   //}}AFX_MSG
   afx_msg LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);
   afx_msg void OnSelectDesk(UINT nID);

   // Friend classes -- the Arrange dialog and the Properties dialog
   friend class CZDDeskArrange;
   friend class CZDDeskProperties;

   DECLARE_MESSAGE_MAP()
};

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

⌨️ 快捷键说明

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