mirror of
https://github.com/Artikash/Example-Extension.git
synced 2024-11-10 11:35:35 +08:00
update documentation
This commit is contained in:
parent
1afad7165c
commit
52db7e6b48
@ -17,19 +17,21 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
|||||||
//#define COPY_CLIPBOARD
|
//#define COPY_CLIPBOARD
|
||||||
//#define EXTRA_NEWLINES
|
//#define EXTRA_NEWLINES
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Param sentence: sentence received by Textractor (UTF-16).
|
Param sentence: sentence received by Textractor (UTF-16). Can be modified, Textractor will receive this modification only if true is returned.
|
||||||
* Param sentenceInfo: contains miscellaneous info about the sentence (see README).
|
Param sentenceInfo: contains miscellaneous info about the sentence (see README).
|
||||||
* Return value: whether the sentence was modified.
|
Return value: whether the sentence was modified.
|
||||||
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
||||||
* THIS FUNCTION MAY BE RUN SEVERAL TIMES CONCURRENTLY: PLEASE ENSURE THAT IT IS THREAD SAFE!
|
The sentence will be destroyed if it is empty or if you call Skip().
|
||||||
|
This function may be run concurrently with itself: please make sure it's thread safe.
|
||||||
|
It will not be run concurrently with DllMain.
|
||||||
*/
|
*/
|
||||||
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||||
{
|
{
|
||||||
// Your code here...
|
// Your code here...
|
||||||
#ifdef COPY_CLIPBOARD
|
#ifdef COPY_CLIPBOARD
|
||||||
// This example extension automatically copies sentences from the hook currently selected by the user into the clipboard.
|
// This example extension automatically copies sentences from the hook currently selected by the user into the clipboard.
|
||||||
if (sentenceInfo["current select"] == 1)
|
if (sentenceInfo["current select"])
|
||||||
{
|
{
|
||||||
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (sentence.size() + 2) * sizeof(wchar_t));
|
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (sentence.size() + 2) * sizeof(wchar_t));
|
||||||
memcpy(GlobalLock(hMem), sentence.c_str(), (sentence.size() + 2) * sizeof(wchar_t));
|
memcpy(GlobalLock(hMem), sentence.c_str(), (sentence.size() + 2) * sizeof(wchar_t));
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
|
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
|
You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
|
||||||
* Param sentence: pointer to sentence received by Textractor (UTF-16).
|
Param sentence: pointer to sentence received by Textractor (UTF-16).
|
||||||
* This can be modified. Textractor uses the modified sentence for future processing and display. If empty (starts with null terminator), Textractor will destroy it.
|
This can be modified. Textractor uses the modified sentence for future processing and display. If empty (starts with null terminator), Textractor will destroy it.
|
||||||
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
||||||
* The buffer is allocated using HeapAlloc(). If you want to make it larger, please use HeapReAlloc().
|
The buffer is allocated using HeapAlloc(). If you want to make it larger, please use HeapReAlloc().
|
||||||
* Param miscInfo: pointer to array containing misc info about the sentence. End of array is marked with name being nullptr.
|
Param miscInfo: pointer to array containing misc info about the sentence. End of array is marked with name being nullptr.
|
||||||
* Return value: the buffer used for the sentence. Remember to return a new pointer if HeapReAlloc() gave you one.
|
Return value: the buffer used for the sentence. Remember to return a new pointer if HeapReAlloc() gave you one.
|
||||||
* THIS FUNCTION MAY BE RUN SEVERAL TIMES CONCURRENTLY: PLEASE ENSURE THAT IT IS THREAD SAFE!
|
This function may be run concurrently with itself: please make sure it's thread safe.
|
||||||
|
It will not be run concurrently with DllMain.
|
||||||
*/
|
*/
|
||||||
extern "C" __declspec(dllexport) wchar_t* OnNewSentence(wchar_t* sentence, const InfoForExtension* miscInfo)
|
extern "C" __declspec(dllexport) wchar_t* OnNewSentence(wchar_t* sentence, const InfoForExtension* miscInfo)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,8 @@ After the sentence has been processed by all extensions, it will be displayed.
|
|||||||
```"process id"```: process id that the sentence is coming from. 0 for console and clipboard.<br>
|
```"process id"```: process id that the sentence is coming from. 0 for console and clipboard.<br>
|
||||||
```"text number"```: number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.<br>
|
```"text number"```: number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.<br>
|
||||||
```"text name"```: pointer to start of a wchar array of the name of the current text thread.<br>
|
```"text name"```: pointer to start of a wchar array of the name of the current text thread.<br>
|
||||||
|
```"void (*AddSentence)(void* this, int64_t number, const wchar_t* sentence)"```: pointer to function that adds a sentence to the text thread with the specified number.<br>
|
||||||
|
```"this"```: context pointer used for aforementioned function.
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user