本文整理汇总了C++中NppParameters::useNewStyleSaveDlg方法的典型用法代码示例。如果您正苦于以下问题:C++ NppParameters::useNewStyleSaveDlg方法的具体用法?C++ NppParameters::useNewStyleSaveDlg怎么用?C++ NppParameters::useNewStyleSaveDlg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NppParameters
的用法示例。
在下文中一共展示了NppParameters::useNewStyleSaveDlg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
TCHAR * FileDialog::doSaveDlg()
{
TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir);
//_ofn.lpstrInitialDir = dir;
NppParameters * params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir();
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
if (!params->useNewStyleSaveDlg())
{
_ofn.Flags |= OFN_ENABLEHOOK;
_ofn.lpfnHook = OFNHookProc;
}
TCHAR *fn = NULL;
try {
fn = ::GetSaveFileName(&_ofn)?_fileName:NULL;
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
}
} catch(std::exception e) {
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
} catch(...) {
::MessageBox(NULL, TEXT("GetSaveFileName crashes!!!"), TEXT(""), MB_OK);
}
::SetCurrentDirectory(dir);
return (fn);
}
示例2: doOpenSingleFileDlg
TCHAR* FileDialog::doOpenSingleFileDlg()
{
TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir);
NppParameters * params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir();
_ofn.Flags |= OFN_FILEMUSTEXIST;
if (!params->useNewStyleSaveDlg())
{
_ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE;
_ofn.lpfnHook = OFNHookProc;
}
TCHAR *fn = NULL;
try {
fn = ::GetOpenFileName(&_ofn)?_fileName:NULL;
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
}
} catch(std::exception& e) {
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
} catch(...) {
::MessageBox(NULL, TEXT("doOpenSingleFileDlg crashes!!!"), TEXT(""), MB_OK);
}
::SetCurrentDirectory(dir);
return (fn);
}
示例3: lstrlen
stringVector * FileDialog::doOpenMultiFilesDlg()
{
TCHAR dir[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, dir);
NppParameters * params = NppParameters::getInstance();
_ofn.lpstrInitialDir = params->getWorkingDir();
_ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_ENABLESIZING;
if (!params->useNewStyleSaveDlg())
{
_ofn.Flags |= OFN_ENABLEHOOK | OFN_NOVALIDATE;
_ofn.lpfnHook = OFNHookProc;
}
BOOL res = ::GetOpenFileName(&_ofn);
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
}
::SetCurrentDirectory(dir);
if (res)
{
TCHAR* pFn = _fileName + lstrlen(_fileName) + 1;
TCHAR fn[MAX_PATH*8];
memset(fn, 0x0, sizeof(fn));
if (!(*pFn))
{
_fileNames.push_back(generic_string(_fileName));
}
else
{
lstrcpy(fn, _fileName);
if (fn[lstrlen(fn) - 1] != '\\')
lstrcat(fn, TEXT("\\"));
}
int term = lstrlen(fn);
while (*pFn)
{
fn[term] = '\0';
lstrcat(fn, pFn);
_fileNames.push_back(generic_string(fn));
pFn += lstrlen(pFn) + 1;
}
return &_fileNames;
}
return nullptr;
}