本文整理汇总了C++中PluginInfo::_pFuncSetInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::_pFuncSetInfo方法的具体用法?C++ PluginInfo::_pFuncSetInfo怎么用?C++ PluginInfo::_pFuncSetInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInfo
的用法示例。
在下文中一共展示了PluginInfo::_pFuncSetInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPlugin
int PluginsManager::loadPlugin(const generic_string& pluginFilePath, std::vector<generic_string> & dll2Remove)
{
PluginInfo *pi = new PluginInfo;
try {
pi->_moduleName = PathFindFileName(pluginFilePath.c_str());
pi->_hLib = ::LoadLibrary(pluginFilePath.c_str());
if (!pi->_hLib)
throw generic_string(TEXT("Load Library is failed.\nMake \"Runtime Library\" setting of this project as \"Multi-threaded(/MT)\" may cure this problem."));
pi->_pFuncIsUnicode = (PFUNCISUNICODE)GetProcAddress(pi->_hLib, "isUnicode");
#ifdef UNICODE
if (!pi->_pFuncIsUnicode || !pi->_pFuncIsUnicode())
throw generic_string(TEXT("This ANSI plugin is not compatible with your Unicode Notepad++."));
#else
if (pi->_pFuncIsUnicode)
throw generic_string(TEXT("This Unicode plugin is not compatible with your ANSI mode Notepad++."));
#endif
pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo");
if (!pi->_pFuncSetInfo)
throw generic_string(TEXT("Missing \"setInfo\" function"));
pi->_pFuncGetName = (PFUNCGETNAME)GetProcAddress(pi->_hLib, "getName");
if (!pi->_pFuncGetName)
throw generic_string(TEXT("Missing \"getName\" function"));
pi->_pBeNotified = (PBENOTIFIED)GetProcAddress(pi->_hLib, "beNotified");
if (!pi->_pBeNotified)
throw generic_string(TEXT("Missing \"beNotified\" function"));
pi->_pMessageProc = (PMESSAGEPROC)GetProcAddress(pi->_hLib, "messageProc");
if (!pi->_pMessageProc)
throw generic_string(TEXT("Missing \"messageProc\" function"));
pi->_pFuncSetInfo(_nppData);
pi->_pFuncGetFuncsArray = (PFUNCGETFUNCSARRAY)GetProcAddress(pi->_hLib, "getFuncsArray");
if (!pi->_pFuncGetFuncsArray)
throw generic_string(TEXT("Missing \"getFuncsArray\" function"));
pi->_funcItems = pi->_pFuncGetFuncsArray(&pi->_nbFuncItem);
if ((!pi->_funcItems) || (pi->_nbFuncItem <= 0))
throw generic_string(TEXT("Missing \"FuncItems\" array, or the nb of Function Item is not set correctly"));
pi->_pluginMenu = ::CreateMenu();
GetLexerCountFn GetLexerCount = (GetLexerCountFn)::GetProcAddress(pi->_hLib, "GetLexerCount");
// it's a lexer plugin
if (GetLexerCount)
{
GetLexerNameFn GetLexerName = (GetLexerNameFn)::GetProcAddress(pi->_hLib, "GetLexerName");
if (!GetLexerName)
throw generic_string(TEXT("Loading GetLexerName function failed."));
GetLexerStatusTextFn GetLexerStatusText = (GetLexerStatusTextFn)::GetProcAddress(pi->_hLib, "GetLexerStatusText");
if (!GetLexerStatusText)
throw generic_string(TEXT("Loading GetLexerStatusText function failed."));
// Assign a buffer for the lexer name.
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
NppParameters * nppParams = NppParameters::getInstance();
ExternalLangContainer *containers[30];
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
for (int x = 0; x < numLexers; x++)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
#ifdef UNICODE
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
#else
const TCHAR *pLexerName = lexName;
#endif
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath);
PathAddExtension(xmlPath, TEXT(".xml"));
if (!PathFileExists(xmlPath))
{
//.........这里部分代码省略.........
示例2: loadPlugin
int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_string> & dll2Remove)
{
const TCHAR *pluginFileName = ::PathFindFileName(pluginFilePath);
if (isInLoadedDlls(pluginFileName))
return 0;
NppParameters * nppParams = NppParameters::getInstance();
PluginInfo *pi = new PluginInfo;
try
{
pi->_moduleName = pluginFileName;
if (GetBinaryArchitectureType(pluginFilePath) != ARCH_TYPE)
throw generic_string(ARCH_ERR_MSG);
pi->_hLib = ::LoadLibrary(pluginFilePath);
if (!pi->_hLib)
{
generic_string lastErrorMsg = GetLastErrorAsString();
if (lastErrorMsg.empty())
throw generic_string(TEXT("Load Library has failed.\nChanging the project's \"Runtime Library\" setting to \"Multi-threaded(/MT)\" might solve this problem."));
else
throw generic_string(lastErrorMsg.c_str());
}
pi->_pFuncIsUnicode = (PFUNCISUNICODE)GetProcAddress(pi->_hLib, "isUnicode");
if (!pi->_pFuncIsUnicode || !pi->_pFuncIsUnicode())
throw generic_string(TEXT("This ANSI plugin is not compatible with your Unicode Notepad++."));
pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo");
if (!pi->_pFuncSetInfo)
throw generic_string(TEXT("Missing \"setInfo\" function"));
pi->_pFuncGetName = (PFUNCGETNAME)GetProcAddress(pi->_hLib, "getName");
if (!pi->_pFuncGetName)
throw generic_string(TEXT("Missing \"getName\" function"));
pi->_funcName = pi->_pFuncGetName();
pi->_pBeNotified = (PBENOTIFIED)GetProcAddress(pi->_hLib, "beNotified");
if (!pi->_pBeNotified)
throw generic_string(TEXT("Missing \"beNotified\" function"));
pi->_pMessageProc = (PMESSAGEPROC)GetProcAddress(pi->_hLib, "messageProc");
if (!pi->_pMessageProc)
throw generic_string(TEXT("Missing \"messageProc\" function"));
pi->_pFuncSetInfo(_nppData);
pi->_pFuncGetFuncsArray = (PFUNCGETFUNCSARRAY)GetProcAddress(pi->_hLib, "getFuncsArray");
if (!pi->_pFuncGetFuncsArray)
throw generic_string(TEXT("Missing \"getFuncsArray\" function"));
pi->_funcItems = pi->_pFuncGetFuncsArray(&pi->_nbFuncItem);
if ((!pi->_funcItems) || (pi->_nbFuncItem <= 0))
throw generic_string(TEXT("Missing \"FuncItems\" array, or the nb of Function Item is not set correctly"));
pi->_pluginMenu = ::CreateMenu();
GetLexerCountFn GetLexerCount = (GetLexerCountFn)::GetProcAddress(pi->_hLib, "GetLexerCount");
// it's a lexer plugin
if (GetLexerCount)
{
GetLexerNameFn GetLexerName = (GetLexerNameFn)::GetProcAddress(pi->_hLib, "GetLexerName");
if (!GetLexerName)
throw generic_string(TEXT("Loading GetLexerName function failed."));
GetLexerStatusTextFn GetLexerStatusText = (GetLexerStatusTextFn)::GetProcAddress(pi->_hLib, "GetLexerStatusText");
if (!GetLexerStatusText)
throw generic_string(TEXT("Loading GetLexerStatusText function failed."));
// Assign a buffer for the lexer name.
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
ExternalLangContainer *containers[30];
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
for (int x = 0; x < numLexers; ++x)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
//.........这里部分代码省略.........