Skip to content

API for interaction from other plugins

Sergey Semushin edited this page Apr 8, 2024 · 1 revision

DSPELLCHECK_SETLANG_MSG

Set the language if it's available

Rough example of usage in C++

CommunicationInfo comm_info;
comm_info.internalMsg = DSPELLCHECK_SETLANG_MSG;
comm_info.srcModuleName = L"AwesomeModule.dll";
DSpellCheckSetLangMsgInfo info;
info.lang_name = L"en_US";
bool success;
info.was_success = &success
comm_info.info = &info;
SendMessage(NppHandle, NPPM_MSGTOPLUGIN, reinterpret_cast<WPARAM>(L"DSpellCheck.dll"), reinterpret_cast<LPARAM>(&comm_info));

DSPELLCHECK_GETLANGUAGELIST_MSG

Get the list of languages available currently.

Rough example of usage in C++

CommunicationInfo comm_info;
comm_info.internalMsg = DSPELLCHECK_GETLANGUAGELIST_MSG;
comm_info.srcModuleName = L"AwesomeModule.dll";
DSpellCheckGetLanguageListMsgInfo info;
std::vector<std::wstring> v;
info.payload = &v;
info.language_callback = [](void *v, const wchar_t *lang) { reinterpret_cast<std::vector<std::wstring> *>(v)->push_back(lang); };
comm_info.info = &info;
SendMessage(NppHandle, NPPM_MSGTOPLUGIN, reinterpret_cast<WPARAM>(L"DSpellCheck.dll"), reinterpret_cast<LPARAM>(&comm_info));