本文整理汇总了C++中NppParameters::destroyInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ NppParameters::destroyInstance方法的具体用法?C++ NppParameters::destroyInstance怎么用?C++ NppParameters::destroyInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NppParameters
的用法示例。
在下文中一共展示了NppParameters::destroyInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
//.........这里部分代码省略.........
if (isRelative)
{
::GetFullPathName(currentFile, MAX_PATH, fullFileName, NULL);
quotFileName += fullFileName;
}
else
{
if ((currentFile[0] == '\\' && currentFile[1] != '\\') || currentFile[0] == '/')
{
quotFileName += getDriveLetter();
quotFileName += ':';
}
quotFileName += currentFile;
}
quotFileName += TEXT("\" ");
}
}
//Only after loading all the file paths set the working directory
::SetCurrentDirectory(NppParameters::getInstance()->getNppPath().c_str()); //force working directory to path of module, preventing lock
if ((!isMultiInst) && (!TheFirstOne))
{
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
for (int i = 0 ;!hNotepad_plus && i < 5 ; ++i)
{
Sleep(100);
hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
}
if (hNotepad_plus)
{
// First of all, destroy static object NppParameters
pNppParameters->destroyInstance();
MainFileManager->destroyInstance();
int sw = 0;
if (::IsZoomed(hNotepad_plus))
sw = SW_MAXIMIZE;
else if (::IsIconic(hNotepad_plus))
sw = SW_RESTORE;
/* REMOVED
else
sw = SW_SHOW;
// IMPORTANT !!!
::ShowWindow(hNotepad_plus, sw);
DEVOMER*/
/* ADDED */
if (sw != 0)
::ShowWindow(hNotepad_plus, sw);
/* DEDDA */
::SetForegroundWindow(hNotepad_plus);
if (params.size() > 0) //if there are files to open, use the WM_COPYDATA system
{
COPYDATASTRUCT paramData;
paramData.dwData = COPYDATA_PARAMS;
paramData.lpData = &cmdLineParams;
paramData.cbData = sizeof(cmdLineParams);
COPYDATASTRUCT fileNamesData;
fileNamesData.dwData = COPYDATA_FILENAMES;
fileNamesData.lpData = (void *)quotFileName.c_str();
示例2: WinMain
//.........这里部分代码省略.........
generic_string quotFileName = TEXT("");
// tell the running instance the FULL path to the new files to load
size_t nbFilesToOpen = params.size();
for (size_t i = 0; i < nbFilesToOpen; ++i)
{
const TCHAR * currentFile = params.at(i).c_str();
if (currentFile[0])
{
//check if relative or full path. Relative paths dont have a colon for driveletter
quotFileName += TEXT("\"");
quotFileName += relativeFilePathToFullFilePath(currentFile);
quotFileName += TEXT("\" ");
}
}
//Only after loading all the file paths set the working directory
::SetCurrentDirectory(NppParameters::getInstance()->getNppPath().c_str()); //force working directory to path of module, preventing lock
if ((!isMultiInst) && (!TheFirstOne))
{
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
for (int i = 0 ;!hNotepad_plus && i < 5 ; ++i)
{
Sleep(100);
hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
}
if (hNotepad_plus)
{
// First of all, destroy static object NppParameters
pNppParameters->destroyInstance();
MainFileManager->destroyInstance();
int sw = 0;
if (::IsZoomed(hNotepad_plus))
sw = SW_MAXIMIZE;
else if (::IsIconic(hNotepad_plus))
sw = SW_RESTORE;
if (sw != 0)
::ShowWindow(hNotepad_plus, sw);
::SetForegroundWindow(hNotepad_plus);
if (params.size() > 0) //if there are files to open, use the WM_COPYDATA system
{
CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(cmdLineParams);
COPYDATASTRUCT paramData;
paramData.dwData = COPYDATA_PARAMS;
paramData.lpData = &dto;
paramData.cbData = sizeof(dto);
COPYDATASTRUCT fileNamesData;
fileNamesData.dwData = COPYDATA_FILENAMES;
fileNamesData.lpData = (void *)quotFileName.c_str();
fileNamesData.cbData = long(quotFileName.length() + 1)*(sizeof(TCHAR));
::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast<WPARAM>(hInstance), reinterpret_cast<LPARAM>(¶mData));
::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast<WPARAM>(hInstance), reinterpret_cast<LPARAM>(&fileNamesData));
}
return 0;