📄 hiddenwnd.h
字号:
// HiddenWnd.h : interface of the CHiddenWindow class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_HIDDENWND_H__65DA3445_4922_4EFF_8008_15CDDC626CDC__INCLUDED_)
#define AFX_HIDDENWND_H__65DA3445_4922_4EFF_8008_15CDDC626CDC__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "aboutdlg.h"
#include "NoteDlg.h"
#include "NotesArchive.h"
#include "SearchDlg.h"
#include <Userenv.h>
#include <Lmcons.h>
#define APP_NAME _T("Sticky Notes")
#define DEFAULT_FILE_NAME _T("notes.dat")
// Taskbar message
#define WMU_NOTIFYICON WM_APP + 1
// Message to display a note
#define WMU_DISPLAYNOTE WM_APP + 2
class CSearchDlg;
// This is a hidden window which is used to send a message to the taskbar's status
// area (add and remove an icon to the taskbar status area) and handle all
// other application tasks like creating a new note, searching and so on.
class CHiddenWindow : public CWindowImpl<CHiddenWindow>
{
private:
NOTIFYICONDATA m_nid;
CMenu m_PopupMenu; // top-level popup menu
string m_strFileName; // name of the file to store notes
CSearchDlg * m_pSearchDlg; // pointer to the search dialog
public:
HICON m_hIconNotes;
vector<CNote> m_vecNotes; // vector containing all saved notes
CHiddenWindow();
~CHiddenWindow();
BEGIN_MSG_MAP(CHiddenWindow)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WMU_NOTIFYICON, OnNotifyIcon)
MESSAGE_HANDLER(WMU_DISPLAYNOTE, OnDisplayNote)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_QUERYENDSESSION, OnEndSession)
COMMAND_HANDLER(ID_POPUP_NEWNOTE, 0, OnNewNote)
COMMAND_HANDLER(ID_POPUP_SEARCH, 0, OnSearch)
COMMAND_HANDLER(ID_POPUP_ABOUT, 0, OnAbout)
COMMAND_HANDLER(ID_POPUP_EXIT, 0, OnExit)
END_MSG_MAP()
BOOL AddIconToTaskBar(HWND hwnd, UINT uID, HICON hicon, LPSTR lpszTip);
BOOL RemoveIconFromTaskBar(HWND hwnd, UINT uID);
protected:
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnEndSession(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNotifyIcon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDisplayNote(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT DisplayShortcutMenu();
LRESULT OnNewNote(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnAbout(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnExit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT CreateNewNote();
bool LoadNotes();
bool SaveNotes();
string GetFileName();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HIDDENWND_H__65DA3445_4922_4EFF_8008_15CDDC626CDC__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -