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

📄 akeldll.h

📁 一个类似于notepad的文本编辑器源代码
💻 H
📖 第 1 页 / 共 4 页
字号:
Example PostMessage (bOldWindows == FALSE):
 PLUGINCALLPOSTW *pc;
 if (pc=(PLUGINCALLPOSTW *)GlobalAlloc(GPTR, sizeof(PLUGINCALLPOSTW)))
 {
   lstrcpynW(pc->wszFunction, wszFunction, MAX_PATH);
   pc->bOnStart=FALSE;
   pc->lParam=0;
   PostMessage(pd->hMainWnd, AKD_DLLCALL, 0, (LPARAM)pc);
 }


AKD_DLLUNLOAD
_____________

Unload dll.

wParam == not used
lParam == pointer to a PLUGINUNLOADSEND structure if SendMessage used
          (PLUGINUNLOADSENDA *)lParam   if bOldWindows == TRUE
          (PLUGINUNLOADSENDW *)lParam   if bOldWindows == FALSE
          or pointer to a PLUGINUNLOADPOST, allocated with GlobalAlloc, if PostMessage used
          (PLUGINUNLOADPOSTA *)lParam   if bOldWindows == TRUE
          (PLUGINUNLOADPOSTW *)lParam   if bOldWindows == FALSE

Return Value
 zero

Example SendMessage (bOldWindows == TRUE):
 PLUGINUNLOADSENDA pu;
 pu.szFunction=szFunction;
 pu.hInstanceDLL=pd->hInstanceDLL;
 pu.hThread=NULL;
 SendMessage(pd->hMainWnd, AKD_DLLUNLOAD, 0, (LPARAM)&pu);

Example SendMessage (bOldWindows == FALSE):
 PLUGINUNLOADSENDW pu;
 pu.wszFunction=wszFunction;
 pu.hInstanceDLL=pd->hInstanceDLL;
 pu.hThread=NULL;
 SendMessage(pd->hMainWnd, AKD_DLLUNLOAD, 0, (LPARAM)&pu);

Example PostMessage (bOldWindows == TRUE):
 PLUGINUNLOADPOSTA *pu;
 if (pu=(PLUGINUNLOADPOSTA *)GlobalAlloc(GPTR, sizeof(PLUGINUNLOADPOSTA)))
 {
   lstrcpyn(pu->szFunction, szFunction, MAX_PATH);
   pu->hInstanceDLL=pd->hInstanceDLL;
   pu->hThread=NULL;
   PostMessage(pd->hMainWnd, AKD_DLLUNLOAD, 0, (LPARAM)pu);
 }

Example PostMessage (bOldWindows == FALSE):
 PLUGINUNLOADPOSTW *pu;
 if (pu=(PLUGINUNLOADPOSTW *)GlobalAlloc(GPTR, sizeof(PLUGINUNLOADPOSTW)))
 {
   lstrcpynW(pu->wszFunction, wszFunction, MAX_PATH);
   pu->hInstanceDLL=pd->hInstanceDLL;
   pu->hThread=NULL;
   PostMessage(pd->hMainWnd, AKD_DLLUNLOAD, 0, (LPARAM)pu);
 }


AKD_DLLFIND
___________

Get dll stack function structure pointer.

(unsigned char *)wParam == function name, format "Plugin::Function"
                           (char *)wParam      if bOldWindows == TRUE
                           (wchar_t *)wParam   if bOldWindows == FALSE
lParam                  == not used

Return Value
 pointer to a PLUGINFUNCTION structure

Example (bOldWindows == TRUE):
 PLUGINFUNCTIONA *pf;
 pf=(PLUGINFUNCTIONA *)SendMessage(pd->hMainWnd, AKD_DLLFIND, (WPARAM)"SomePlugin::SomeFunction", 0);
 if (pf) pf->bRunning=FALSE; //change active status

Example (bOldWindows == FALSE):
 PLUGINFUNCTIONW *pf;
 pf=(PLUGINFUNCTIONW *)SendMessage(pd->hMainWnd, AKD_DLLFIND, (WPARAM)L"SomePlugin::SomeFunction", 0);
 if (pf) pf->bRunning=FALSE;  //change active status


AKD_DLLADD
__________

Add dll stack function structure.

wParam                   == not used
(PLUGINFUNCTION *)lParam == function structure pointer
                            (PLUGINFUNCTIONA *)lParam   if bOldWindows == TRUE
                            (PLUGINFUNCTIONW *)lParam   if bOldWindows == FALSE

Return Value
 pointer to a PLUGINFUNCTION structure in stack

Example add plugin hotkey (bOldWindows == TRUE):
 void CALLBACK PluginProc(void *lpParameter)
 {
 }
 PLUGINFUNCTIONA pf;
 pf.szFunction[0]='\0';
 pf.nFunctionLen=0;
 pf.wHotkey=589;       //Ctrl+M
 pf.bOnStart=FALSE;
 pf.bRunning=FALSE;
 pf.PluginProc=(PLUGINPROC)PluginProc;
 pf.lpParameter=NULL;
 SendMessage(pd->hMainWnd, AKD_DLLADD, 0, (LPARAM)&pf);

Example add plugin hotkey (bOldWindows == FALSE):
 void CALLBACK PluginProc(void *lpParameter)
 {
 }
 PLUGINFUNCTIONW pf;
 pf.wszFunction[0]='\0';
 pf.nFunctionLen=0;
 pf.wHotkey=589;       //Ctrl+M
 pf.bOnStart=FALSE;
 pf.bRunning=FALSE;
 pf.PluginProc=(PLUGINPROC)PluginProc;
 pf.lpParameter=NULL;
 SendMessage(pd->hMainWnd, AKD_DLLADD, 0, (LPARAM)&pf);


AKD_DLLDELETE
_____________

Delete dll stack function structure.

wParam                   == not used
(PLUGINFUNCTION *)lParam == pointer to a PLUGINFUNCTION structure
                            (PLUGINFUNCTIONA *)lParam   if bOldWindows == TRUE
                            (PLUGINFUNCTIONW *)lParam   if bOldWindows == FALSE

Return Value
 zero

Example (bOldWindows == TRUE):
 PLUGINFUNCTIONA *pf;
 if (pf=(PLUGINFUNCTIONA *)SendMessage(pd->hMainWnd, AKD_DLLFIND, (WPARAM)"SomePlugin::SomeFunction", 0))
 {
   SendMessage(pd->hMainWnd, AKD_DLLDELETE, 0, (LPARAM)pf);
   pf=NULL;
 }

Example (bOldWindows == FALSE):
 PLUGINFUNCTIONW *pf;
 if (pf=(PLUGINFUNCTIONW *)SendMessage(pd->hMainWnd, AKD_DLLFIND, (WPARAM)L"SomePlugin::SomeFunction", 0))
 {
   SendMessage(pd->hMainWnd, AKD_DLLDELETE, 0, (LPARAM)pf);
   pf=NULL;
 }


AKD_SAVEDOCUMENT
________________

Save file.

(HWND)wParam           == rich edit window
(SAVEDOCUMENT *)lParam == pointer to a SAVEDOCUMENT structure
                         (SAVEDOCUMENTA *)lParam   if bOldWindows == TRUE
                         (SAVEDOCUMENTW *)lParam   if bOldWindows == FALSE

Return Value
 zero                success
 ESD_OPEN            can't open file
 ESD_WRITE           can't write to file
 ESD_CODEPAGE_ERROR  code page isn't implemented
 ESD_STOP            stopped from AKDN_SAVEDOCUMENT_START
 ESD_STREAMOUT       error in EM_STREAMOUT

Example (bOldWindows == TRUE):
 SAVEDOCUMENTA sd;

 lstrcpyn(sd.szFile, "C:\\MyFile.txt", MAX_PATH);
 sd.nCodePage=65001;
 sd.bBOM=TRUE;
 sd.bActivate=TRUE;
 SendMessage(pd->hMainWnd, AKD_SAVEDOCUMENT, (WPARAM)pd->hWndEdit, (LPARAM)&sd);

Example (bOldWindows == FALSE):
 SAVEDOCUMENTW sd;

 lstrcpynW(sd.wszFile, L"C:\\MyFile.txt", MAX_PATH);
 sd.nCodePage=65001;
 sd.bBOM=TRUE;
 sd.bActivate=TRUE;
 SendMessage(pd->hMainWnd, AKD_SAVEDOCUMENT, (WPARAM)pd->hWndEdit, (LPARAM)&sd);


AKD_GETTEXTLENGTH
_________________

Get rich edit window text length.

(HWND)wParam == rich edit window
lParam       == not used

Return Value
 text length

Example:
 int nLength=SendMessage(pd->hMainWnd, AKD_GETTEXTLENGTH, (WPARAM)pd->hWndEdit, 0);


AKD_GETSELTEXTW
_______________

Retrieves the currently selected text in a rich edit control.

(HWND)wParam == rich edit window
lParam       == not used

Return Value
 text pointer

Example:
 wchar_t *wpText;

 wpText=SendMessage(pd->hMainWnd, AKD_GETSELTEXTW, (WPARAM)pd->hWndEdit, 0);
 SendMessage(pd->hMainWnd, AKD_FREETEXT, 0, (LPARAM)wpText);


AKD_GETTEXTRANGE
________________

Retrieves a specified range of characters from a rich edit control.

(HWND)wParam           == rich edit window
(GETTEXTRANGE *)lParam == pointer to a GETTEXTRANGE structure

Return Value
 Text length in TCHARs without null character

Example (bOldWindows == TRUE):
 GETTEXTRANGE gtr;

 gtr.cpMin=0;
 gtr.cpMax=-1;
 SendMessage(pd->hMainWnd, AKD_GETTEXTRANGE, (WPARAM)pd->hWndEdit, (LPARAM)&gtr);
 MessageBox(pd->hMainWnd, (char *)gtr.pText, "Test", MB_OK);
 SendMessage(pd->hMainWnd, AKD_FREETEXT, 0, (LPARAM)gtr.pText);

Example (bOldWindows == FALSE):
 GETTEXTRANGE gtr;

 gtr.cpMin=0;
 gtr.cpMax=-1;
 SendMessage(pd->hMainWnd, AKD_GETTEXTRANGE, (WPARAM)pd->hWndEdit, (LPARAM)&gtr);
 MessageBoxW(pd->hMainWnd, (wchar_t *)gtr.pText, L"Test", MB_OK);
 SendMessage(pd->hMainWnd, AKD_FREETEXT, 0, (LPARAM)gtr.pText);


AKD_FREETEXT
____________

Free text buffer allocated with AKD_GETTEXTRANGE.

wParam                  == not used
(unsigned char *)lParam == buffer pointer

Return Value
 TRUE   success
 FALSE  failed

See AKD_GETTEXTRANGE.


AKD_REPLACESELA
_______________

Replace selection of the rich edit control.

(HWND)wParam   == rich edit window
(char *)lParam == text pointer

Return Value
 zero

Example:
 SendMessage(pd->hMainWnd, AKD_REPLACESELA, (WPARAM)pd->hWndEdit, (LPARAM)"SomeString");


AKD_REPLACESELW
_______________

Replace selection of the rich edit control.

(HWND)wParam      == rich edit window
(wchar_t *)lParam == text pointer

Return Value
 zero

Example:
 SendMessage(pd->hMainWnd, AKD_REPLACESELW, (WPARAM)pd->hWndEdit, (LPARAM)L"SomeString");


AKD_PASTE
_________

Paste text from clipboard to the rich edit control.

(HWND)wParam == rich edit window
(BOOL)lParam == FALSE paste as Unicode text (default)
                TRUE  paste as ANSI text

Return Value
 zero

Example:
 SendMessage(pd->hMainWnd, AKD_PASTE, (WPARAM)pd->hWndEdit, FALSE);


AKD_COPY
________

Copy text to clipboard from rich edit control.

(HWND)wParam == rich edit window
lParam       == not used

Return Value
 zero

Example:
 SendMessage(pd->hMainWnd, AKD_COPY, (WPARAM)pd->hWndEdit, 0);


AKD_TEXTFIND
____________

Finds text in a rich edit control.

(HWND)wParam       == rich edit window
(TEXTFIND *)lParam == pointer to a TEXTFIND structure
                      (TEXTFINDA *)lParam   if bOldWindows == TRUE
                      (TEXTFINDW *)lParam   if bOldWindows == FALSE
Return Value
 Character position of the next match. If there are no more matches, the return value is 

⌨️ 快捷键说明

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