mirror of
https://github.com/Artikash/Example-Extension.git
synced 2024-11-23 09:35:37 +08:00
rename
This commit is contained in:
parent
5807ad35e1
commit
fc9cad5978
@ -8,18 +8,18 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
|
|||||||
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 sentenceInfo: 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 concurrently with itself: please make sure it's 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.
|
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* sentenceInfo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::wstring sentenceStr(sentence);
|
std::wstring sentenceStr(sentence);
|
||||||
int origLength = sentenceStr.size();
|
int origLength = sentenceStr.size();
|
||||||
if (ProcessSentence(sentenceStr, SentenceInfo{ miscInfo }))
|
if (ProcessSentence(sentenceStr, SentenceInfo{ sentenceInfo }))
|
||||||
{
|
{
|
||||||
if (sentenceStr.size() > origLength) sentence = (wchar_t*)HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sentence, (sentenceStr.size() + 1) * sizeof(wchar_t));
|
if (sentenceStr.size() > origLength) sentence = (wchar_t*)HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sentence, (sentenceStr.size() + 1) * sizeof(wchar_t));
|
||||||
wcscpy_s(sentence, sentenceStr.size() + 1, sentenceStr.c_str());
|
wcscpy_s(sentence, sentenceStr.size() + 1, sentenceStr.c_str());
|
||||||
|
21
README.md
21
README.md
@ -1,21 +1,18 @@
|
|||||||
# Example Extension
|
# Example Extension
|
||||||
|
|
||||||
Every time Textractor has a sentence of text ready,
|
Every time Textractor has a sentence of text ready, it will call `ProcessSentence` on all extensions it finds sequentially (via `OnNewSentence`)
|
||||||
it will call ```OnNewSentence``` on all extensions it finds sequentially,
|
|
||||||
plugging the output of ```OnNewSentence``` from the previous extension into the next extension.<br>
|
|
||||||
After the sentence has been processed by all extensions, it will be displayed.
|
After the sentence has been processed by all extensions, it will be displayed.
|
||||||
|
|
||||||
# SentenceInfo
|
# SentenceInfo
|
||||||
|
|
||||||
## The following properties are in ```SentenceInfo```
|
## The following properties are in `SentenceInfo`
|
||||||
```"current select"```: always 0 unless the sentence is in the text thread selected by the user.<br>
|
`"current select"`: always 0 unless the sentence is in the text thread selected by the user.<br>
|
||||||
```"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>
|
`"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.
|
`"this"`: context pointer used for aforementioned function.
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
|
|
||||||
You just need Visual Studio with basic C++ support to compile this project.<br>
|
You just need Visual Studio with basic C++ support to compile this project.
|
||||||
Compile targeting x86 for Textractor and x64 for Textractor64.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user