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

📄 akeldll.h

📁 一个类似于notepad的文本编辑器源代码
💻 H
📖 第 1 页 / 共 4 页
字号:
//Defines
#define ID_EDIT           10001
#define ID_STATUS         10002
#define ID_TAB            10003
#define ID_FIRSTMDI       10010

#define PD_UNLOAD               0
#define PD_NONUNLOAD_ACTIVE     1
#define PD_NONUNLOAD_NONACTIVE  2

#define AUTOANSWER_ASK    0
#define AUTOANSWER_YES    1
#define AUTOANSWER_NO     2

#define OD_ADT_BINARY_ERROR      0x00000001
#define OD_ADT_REG_CODEPAGE      0x00000002
#define OD_ADT_DETECT_CODEPAGE   0x00000004
#define OD_ADT_DETECT_BOM        0x00000008

#define EOD_ADT_OPEN        -1
#define EOD_ADT_ALLOC       -2
#define EOD_ADT_READ        -3
#define EOD_ADT_BINARY      -4
#define EOD_OPEN            -5
#define EOD_CANCEL          -6
#define EOD_WINDOW_EXIST    -7
#define EOD_CODEPAGE_ERROR  -8
#define EOD_STOP            -9
#define EOD_STREAMIN        -10

#define ESD_OPEN            -1
#define ESD_WRITE           -2
#define ESD_READONLY        -3
#define ESD_CODEPAGE_ERROR  -4
#define ESD_STOP            -5
#define ESD_STREAMOUT       -6

#define SS_REGISTRY  1
#define SS_INI       2

#define NEWLINE_WIN  1
#define NEWLINE_UNIX 2

#define PO_READ     1
#define PO_SAVE     2

#define PO_DWORD     1
#define PO_BINARY    2
#define PO_STRING    3

#ifndef FR_DOWN
  #define FR_DOWN      0x00000001
#endif
#ifndef FR_MATCHCASE
  #define FR_MATCHCASE 0x00000004
#endif
#define FR_UP          0x00100000
#define FR_BEGINNING   0x00200000
#define FR_SELECTION   0x00400000
#define FR_ESCAPESEQ   0x00800000
#define FR_ALLFILES    0x01000000

#define IMEMU_EDIT     0x00000001
#define IMEMU_CHECKS   0x00000004


//Structures
typedef void (CALLBACK *PLUGINPROC)(void *);
typedef void (CALLBACK *WNDPROCRET)(CWPRETSTRUCT *);

typedef struct _OPENDOCUMENTA {
  char szFile[MAX_PATH];       //File to open
  char szWorkDir[MAX_PATH];    //Set working directory before open, if (!*szWorkDir) then don't set
  DWORD dwFlags;               //open flags
                               //OD_ADT_BINARY_ERROR     Check if file is binary
                               //OD_ADT_REG_CODEPAGE     If last open code page found in registry, then it will be
                               //                        used with ADT_DETECT_BOM flag, if not found, then next flags
                               //                        will be used ADT_DETECT_CODEPAGE|ADT_DETECT_BOM
                               //OD_ADT_DETECT_CODEPAGE  Detect code page
                               //OD_ADT_DETECT_BOM       Detect BOM mark
  int nCodePage;               //File code page, ignored if (dwFlags & ADT_DETECT_CODEPAGE)
  BOOL bBOM;                   //File BOM, ignored if (dwFlags & ADT_DETECT_BOM)
} OPENDOCUMENTA;

typedef struct _OPENDOCUMENTW {
  wchar_t wszFile[MAX_PATH];     //File to open
  wchar_t wszWorkDir[MAX_PATH];  //Set working directory before open, if (!*wszWorkDir) then don't set
  DWORD dwFlags;                 //open flags
                                 //OD_ADT_BINARY_ERROR     Check if file is binary
                                 //OD_ADT_REG_CODEPAGE     If last open code page found in registry, then it will be
                                 //                        used with ADT_DETECT_BOM flag, if not found, then next flags
                                 //                        will be used ADT_DETECT_CODEPAGE|ADT_DETECT_BOM
                                 //OD_ADT_DETECT_CODEPAGE  Detect code page
                                 //OD_ADT_DETECT_BOM       Detect BOM mark
  int nCodePage;                 //File code page, ignored if (dwFlags & ADT_DETECT_CODEPAGE)
  BOOL bBOM;                     //File BOM, ignored if (dwFlags & ADT_DETECT_BOM)
} OPENDOCUMENTW;

typedef struct _SAVEDOCUMENTA {
  char szFile[MAX_PATH];      //File to save
  int nCodePage;              //File code page
  BOOL bBOM;                  //File BOM
  BOOL bActivate;             //File will be activated
} SAVEDOCUMENTA;

typedef struct _SAVEDOCUMENTW {
  wchar_t wszFile[MAX_PATH];  //File to save
  int nCodePage;              //File code page
  BOOL bBOM;                  //File BOM
  BOOL bActivate;             //File will be activated
} SAVEDOCUMENTW;

typedef struct _WNDFRAMEA {
  HICON hIcon;                //Frame icon
  char szFile[MAX_PATH];      //Frame file
  int nCodePage;              //Frame edit code page
  BOOL bBOM;                  //Frame edit BOM
  int nNewLine;               //Frame edit new line
  BOOL bModified;             //Frame edit modified
  BOOL bReadOnly;             //Frame edit read only
  BOOL bWordWrap;             //Frame edit word wrap
  BOOL bInsertState;          //Frame edit insert state
  int nTabStopSize;           //Frame edit tab stop size
  int nUndoLimit;             //Frame edit undo limit
  BOOL bShowURL;              //Frame edit show URL
  DWORD dwEditMargins;        //Frame edit margins
  BOOL bDelimitersEnable;     //Frame edit delimiters enabled
  COLORREF crFont;            //Frame edit font color
  COLORREF crBackground;      //Frame edit background color
  FILETIME ft;                //Frame file time
  LOGFONTA lf;                //Frame edit font
} WNDFRAMEA;

typedef struct _WNDFRAMEW {
  HICON hIcon;                //Frame icon
  wchar_t wszFile[MAX_PATH];  //Frame file
  int nCodePage;              //Frame edit code page
  BOOL bBOM;                  //Frame edit BOM
  int nNewLine;               //Frame edit new line
  BOOL bModified;             //Frame edit modified
  BOOL bReadOnly;             //Frame edit read only
  BOOL bWordWrap;             //Frame edit word wrap
  BOOL bInsertState;          //Frame edit insert state
  int nTabStopSize;           //Frame edit tab stop size
  int nUndoLimit;             //Frame edit undo limit
  BOOL bShowURL;              //Frame edit show URL
  DWORD dwEditMargins;        //Frame edit margins
  BOOL bDelimitersEnable;     //Frame edit delimiters enabled
  COLORREF crFont;            //Frame edit font color
  COLORREF crBackground;      //Frame edit background color
  FILETIME ft;                //Frame file time
  LOGFONTW lf;                //Frame edit font
} WNDFRAMEW;

typedef struct _WNDPROCDATA {
  struct _WNDPROCDATA *next;
  struct _WNDPROCDATA *prev;
  WNDPROC CurProc;
  WNDPROC NextProc;
  WNDPROC PrevProc;
} WNDPROCDATA;

typedef struct _WNDPROCRETDATA {
  struct _WNDPROCRETDATA *next;
  struct _WNDPROCRETDATA *prev;
  WNDPROCRET CurProc;
  WNDPROCRET NextProc;
  WNDPROCRET PrevProc;
} WNDPROCRETDATA;

typedef struct _PLUGINDATA {
  DWORD cb;                 //Size of the structure
  int *nUnload;             //PD_UNLOAD               unload plugin (default)
                            //PD_NONUNLOAD_ACTIVE     don't unload plugin and set active status
                            //PD_NONUNLOAD_NONACTIVE  don't unload plugin and set non-active status
  BOOL bActive;             //Plugin already loaded
  BOOL bOnStart;            //TRUE  if plugin called on start-up
                            //FALSE if plugin called manually
  LPARAM lParam;            //Input data
  HINSTANCE hInstanceDLL;   //DLL instance
  HINSTANCE hInstanceEXE;   //EXE instance
  HWND hMainWnd;            //Main window
  HWND hWndEdit;            //RichEdit window
  HWND hStatus;             //StatusBar window
  HWND hMdiClient;          //MDI client window (if bMDI == TRUE)
  HWND hTab;                //Tab window        (if bMDI == TRUE)
  HMENU hMainMenu;          //Main menu
  HMENU hMenuRecentFiles;   //Recent files menu
  HMENU hMenuLanguage;      //Language menu
  HMENU hPopupMenu;         //Right click menu
  HICON hMainIcon;          //Main window icon handle
  BOOL bOldWindows;         //Non-Unicode Windows
  BOOL bOldRichEdit;        //riched20.dll lower then 5.30 (v3.0)
  BOOL bOldComctl32;        //comctl32.dll lower then 4.71
  BOOL bMDI;                //MDI mode
  unsigned char *pFile;     //Current editing file
                            //char *pFile         if bOldWindows == TRUE
                            //wchar_t *pFile      if bOldWindows == FALSE
  unsigned char *pAkelDir;  //AkelPad directory
                            //char *pAkelDir      if bOldWindows == TRUE
                            //wchar_t *pAkelDir   if bOldWindows == FALSE
  unsigned char *pFunction; //Called function name, format "Plugin::Function"
                            //char *pFunction     if bOldWindows == TRUE
                            //wchar_t *pFunction  if bOldWindows == FALSE
  int nSaveSettings;        //Setting in SS_REGISTRY or SS_INI
  LANGID wLangSystem;       //System language ID
} PLUGINDATA;

typedef struct _PLUGINFUNCTIONA {
  struct _PLUGINFUNCTIONA *next;
  struct _PLUGINFUNCTIONA *prev;
  char szFunction[MAX_PATH];      //Function name, format "Plugin::Function"
  int nFunctionLen;               //Function name length
  WORD wHotkey;                   //Function hotkey
  BOOL bOnStart;                  //Function autoload on start-up
  BOOL bRunning;                  //Function is running
  PLUGINPROC PluginProc;          //Function procedure
  void *lpParameter;              //Procedure parameter
} PLUGINFUNCTIONA;

typedef struct _PLUGINFUNCTIONW {
  struct _PLUGINFUNCTIONW *next;
  struct _PLUGINFUNCTIONW *prev;
  wchar_t wszFunction[MAX_PATH];  //Function name, format L"Plugin::Function"
  int nFunctionLen;               //Function name length
  WORD wHotkey;                   //Function hotkey
  BOOL bOnStart;                  //Function autoload on start-up
  BOOL bRunning;                  //Function is running
  PLUGINPROC PluginProc;          //Function procedure
  void *lpParameter;              //Procedure parameter
} PLUGINFUNCTIONW;

typedef struct _PLUGINCALLSENDA {
  char *szFunction;               //Function name, format "Plugin::Function"
  BOOL bOnStart;                  //TRUE  if plugin called on start-up
                                  //FALSE if plugin called manually
  LPARAM lParam;                  //Input data
} PLUGINCALLSENDA;

typedef struct _PLUGINCALLSENDW {
  wchar_t *wszFunction;           //Function name, format L"Plugin::Function"
  BOOL bOnStart;                  //TRUE  if plugin called on start-up
                                  //FALSE if plugin called manually
  LPARAM lParam;                  //Input data
} PLUGINCALLSENDW;

typedef struct _PLUGINCALLPOSTA {
  char szFunction[MAX_PATH];      //Function name, format "Plugin::Function"
  BOOL bOnStart;                  //TRUE  if plugin called on start-up
                                  //FALSE if plugin called manually
  LPARAM lParam;                  //Input data
} PLUGINCALLPOSTA;

typedef struct _PLUGINCALLPOSTW {
  wchar_t wszFunction[MAX_PATH];  //Function name, format L"Plugin::Function"
  BOOL bOnStart;                  //TRUE  if plugin called on start-up
                                  //FALSE if plugin called manually
  LPARAM lParam;                  //Input data
} PLUGINCALLPOSTW;

typedef struct PLUGINUNLOADSENDA {
  char *szFunction;               //Function name, format "Plugin::Function"
  HMODULE hInstanceDLL;           //NULL if plugin must not be unloaded.
  HANDLE hThread;                 //NULL if plugin not exiting from thread.
} PLUGINUNLOADSENDA;

typedef struct PLUGINUNLOADSENDW {
  wchar_t *wszFunction;           //Function name, format L"Plugin::Function"
  HMODULE hInstanceDLL;           //NULL if plugin must not be unloaded.
  HANDLE hThread;                 //NULL if plugin not exiting from thread.
} PLUGINUNLOADSENDW;

typedef struct PLUGINUNLOADPOSTA {
  char szFunction[MAX_PATH];      //Function name, format "Plugin::Function"
  HMODULE hInstanceDLL;           //NULL if plugin must not be unloaded.
  HANDLE hThread;                 //NULL if plugin not exiting from thread.
} PLUGINUNLOADPOSTA;

typedef struct PLUGINUNLOADPOSTW {
  wchar_t wszFunction[MAX_PATH];  //Function name, format L"Plugin::Function"
  HMODULE hInstanceDLL;           //NULL if plugin must not be unloaded.
  HANDLE hThread;                 //NULL if plugin not exiting from thread.
} PLUGINUNLOADPOSTW;

typedef struct _PLUGINOPTIONA {
  char *szOptionName;            //Option name
  DWORD dwType;                  //Data type: PO_DWORD, PO_BINARY or PO_STRING
  BYTE *lpData;                  //Data pointer
  DWORD dwData;                  //Data size in bytes
} PLUGINOPTIONA;

typedef struct _PLUGINOPTIONW {
  wchar_t *wszOptionName;        //Option name
  DWORD dwType;                  //Data type: PO_DWORD, PO_BINARY or PO_STRING
  BYTE *lpData;                  //Data pointer
  DWORD dwData;                  //Data size in bytes
} PLUGINOPTIONW;

typedef struct _GETTEXTRANGE {
  int cpMin;                      //First character in the range. First char of text: 0.
  int cpMax;                      //Last character in the range. Last char of text: -1.
  unsigned char *pText;           //Pointer to buffer that receives the text.
                                  //char *pText      if bOldWindows == TRUE
                                  //wchar_t *pText   if bOldWindows == FALSE
} GETTEXTRANGE;

typedef struct _EDITINFO {
  HWND hWndEdit;            //RichEdit window
  unsigned char *pFile;     //Current editing file
                            //char *pFile         if bOldWindows == TRUE
                            //wchar_t *pFile      if bOldWindows == FALSE
  int nCodePage;            //Current code page
  BOOL bBOM;                //Current BOM
  int nNewLine;             //Current new line format
  BOOL bModified;           //File has been modified
  BOOL bReadOnly;           //Read only
  BOOL bWordWrap;           //Word wrap
  BOOL bInsertState;        //Insert mode
  int nTabStopSize;         //Tab stop size
  BOOL bTabStopAsSpaces;    //Insert tab stop as spaces
  int nUndoLimit;           //Undo limit
  BOOL bDetailedUndo;       //Detailed undo
  BOOL bShowURL;            //Show URL
  DWORD dwEditMargins;      //Edit margins
  BOOL bDelimitersEnable;   //Delimiters enabled
  COLORREF crFont;          //Font color
  COLORREF crBackground;    //Background color
  FILETIME ft;              //File time
} EDITINFO;

typedef struct _TEXTFINDA {
  DWORD dwFlags;            //Search flags
  char *pFindIt;            //Find string
} TEXTFINDA;

typedef struct _TEXTFINDW {
  DWORD dwFlags;            //Search flags
  wchar_t *wpFindIt;        //Find string
} TEXTFINDW;

typedef struct _TEXTREPLACEA {
  DWORD dwFlags;            //Search flags
  char *pFindIt;            //Find string
  char *pReplaceWith;       //Replace string
  BOOL bAll;                //Replace all
  int nChanges;             //Count of changes
} TEXTREPLACEA;

⌨️ 快捷键说明

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