本文整理汇总了C++中CSysString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CSysString::IsEmpty方法的具体用法?C++ CSysString::IsEmpty怎么用?C++ CSysString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSysString
的用法示例。
在下文中一共展示了CSysString::IsEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NormalizeDirPathPrefix
void NormalizeDirPathPrefix(CSysString &dirPath)
{
if (dirPath.IsEmpty())
return;
if (dirPath.ReverseFind(kDirDelimiter) != dirPath.Length() - 1)
dirPath += kDirDelimiter;
}
示例2: MyGetLogicalDriveStrings
bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings)
{
driveStrings.Clear();
UINT32 size = GetLogicalDriveStrings(0, NULL);
if (size == 0)
return false;
CSysString buffer;
UINT32 newSize = GetLogicalDriveStrings(size, buffer.GetBuffer(size));
if (newSize == 0)
return false;
if (newSize > size)
return false;
CSysString string;
for (UINT32 i = 0; i < newSize; i++)
{
TCHAR c = buffer[i];
if (c == TEXT('\0'))
{
driveStrings.Add(string);
string.Empty();
}
else
string += c;
}
if (!string.IsEmpty())
return false;
return true;
}
示例3: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */,int /* nCmdShow */)
{
g_hInstance = (HINSTANCE)hInstance;
#ifndef _UNICODE
g_IsNT = IsItWindowsNT();
#endif
InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
UString executeFile, executeParameters;
#endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
UString fullPath;
NDLL::MyGetModuleFileName(g_hInstance, fullPath);
switches.Trim();
bool assumeYes = false;
if (switches.Left(2).CompareNoCase(UString(L"-y")) == 0)
{
assumeYes = true;
switches = switches.Mid(2);
switches.Trim();
}
AString config;
if (!ReadDataString(fullPath, kStartID, kEndID, config))
{
if (!assumeYes)
ShowErrorMessage(L"Can't load config info");
return 1;
}
UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
UString appLaunched;
bool showProgress = true;
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
if (!assumeYes)
ShowErrorMessage(L"Config failed");
return 1;
}
UString friendlyName = GetTextConfigValue(pairs, L"Title");
UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt");
UString progress = GetTextConfigValue(pairs, L"Progress");
if (progress.CompareNoCase(L"no") == 0)
showProgress = false;
int index = FindTextConfigItem(pairs, L"Directory");
if (index >= 0)
dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
MB_ICONQUESTION) != IDYES)
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
#ifdef _SHELL_EXECUTE
executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters") + switches;
#endif
}
NFile::NDirectory::CTempDirectory tempDir;
if (!tempDir.Create(kTempDirPrefix))
{
if (!assumeYes)
ShowErrorMessage(L"Can not create temp folder archive");
return 1;
}
CCodecs *codecs = new CCodecs;
CMyComPtr<IUnknown> compressCodecsInfo = codecs;
HRESULT result = codecs->Load();
if (result != S_OK)
{
ShowErrorMessage(L"Can not load codecs");
return 1;
}
UString tempDirPath = GetUnicodeString(tempDir.GetPath());
{
bool isCorrupt = false;
UString errorMessage;
HRESULT result = ExtractArchive(codecs, fullPath, tempDirPath, showProgress,
isCorrupt, errorMessage);
if (result != S_OK)
{
if (!assumeYes)
{
if (result == S_FALSE || isCorrupt)
{
errorMessage = NWindows::MyLoadStringW(IDS_EXTRACTION_ERROR_MESSAGE);
result = E_FAIL;
//.........这里部分代码省略.........
示例4: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
#ifdef UNDER_CE
LPWSTR
#else
LPSTR
#endif
/* lpCmdLine */,int /* nCmdShow */)
{
g_hInstance = (HINSTANCE)hInstance;
NT_CHECK
#ifdef _WIN32
LoadSecurityDlls();
#endif
// InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
UString executeFile, executeParameters;
#endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
FString fullPath;
NDLL::MyGetModuleFileName(fullPath);
switches.Trim();
bool assumeYes = false;
if (switches.IsPrefixedBy_Ascii_NoCase("-y"))
{
assumeYes = true;
switches = switches.Ptr(2);
switches.Trim();
}
AString config;
if (!ReadDataString(fullPath, kStartID, kEndID, config))
{
if (!assumeYes)
ShowErrorMessage(L"Can't load config info");
return 1;
}
UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
UString appLaunched;
bool showProgress = true;
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
if (!assumeYes)
ShowErrorMessage(L"Config failed");
return 1;
}
UString friendlyName = GetTextConfigValue(pairs, L"Title");
UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt");
UString progress = GetTextConfigValue(pairs, L"Progress");
if (progress.IsEqualTo_Ascii_NoCase("no"))
showProgress = false;
int index = FindTextConfigItem(pairs, L"Directory");
if (index >= 0)
dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
MB_ICONQUESTION) != IDYES)
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
#ifdef _SHELL_EXECUTE
executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters");
#endif
}
CTempDir tempDir;
if (!tempDir.Create(kTempDirPrefix))
{
if (!assumeYes)
ShowErrorMessage(L"Can not create temp folder archive");
return 1;
}
CCodecs *codecs = new CCodecs;
CMyComPtr<IUnknown> compressCodecsInfo = codecs;
{
HRESULT result = codecs->Load();
if (result != S_OK)
{
ShowErrorMessage(L"Can not load codecs");
return 1;
}
}
const FString tempDirPath = tempDir.GetPath();
// tempDirPath = L"M:\\1\\"; // to test low disk space
{
//.........这里部分代码省略.........
示例5: StartApplication
static HRESULT StartApplication(const UString &dir, const UString &path, HWND window, CProcess &process)
{
UINT32 result;
#ifndef _UNICODE
if (g_IsNT)
{
SHELLEXECUTEINFOW execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
execInfo.lpFile = path;
execInfo.lpParameters = NULL;
execInfo.lpDirectory = dir.IsEmpty() ? NULL : (LPCWSTR)dir;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
ShellExecuteExWP shellExecuteExW = (ShellExecuteExWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "ShellExecuteExW");
if (shellExecuteExW == 0)
return 0;
shellExecuteExW(&execInfo);
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
process.Attach(execInfo.hProcess);
}
else
#endif
{
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS
#ifndef UNDER_CE
| SEE_MASK_FLAG_DDEWAIT
#endif
;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
const CSysString sysPath = GetSystemString(path);
const CSysString sysDir = GetSystemString(dir);
execInfo.lpFile = sysPath;
execInfo.lpParameters = NULL;
execInfo.lpDirectory =
#ifdef UNDER_CE
NULL
#else
sysDir.IsEmpty() ? NULL : (LPCTSTR)sysDir
#endif
;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteEx(&execInfo);
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
process.Attach(execInfo.hProcess);
}
if (result <= 32)
{
switch(result)
{
case SE_ERR_NOASSOC:
::MessageBoxW(window,
NError::MyFormatMessageW(::GetLastError()),
// L"There is no application associated with the given file name extension",
L"7-Zip", MB_OK | MB_ICONSTOP);
}
}
return S_OK;
}
示例6: GetFilesReal
//.........这里部分代码省略.........
0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL },
{ DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false,
extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting,
0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL },
{ DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL },
{ DI_RADIOBUTTON, 6, 11, 0, 0, false, true, DIF_GROUP, false, NMessageID::kExtractFilesSelected, NULL, NULL },
{ DI_RADIOBUTTON, 6, 12, 0, 0, false, false, 0, false, NMessageID::kExtractFilesAll, NULL, NULL },
{ DI_SINGLEBOX, kXMid, kPasswordYPos, kXSize - 6, kPasswordYPos + 2, false, false, 0, false, NMessageID::kExtractPassword, NULL, NULL },
{ DI_PSWEDIT, kXMid + 2, kPasswordYPos + 1, kXSize - 8, 12, false, false, 0, false, -1, oemPassword, NULL},
{ DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kExtractExtract, NULL, NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kExtractCancel, NULL, NULL }
};
const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]);
const int kOkButtonIndex = kNumDialogItems - 2;
const int kPasswordIndex = kNumDialogItems - 4;
FarDialogItem dialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
for (;;)
{
int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
kHelpTopicExtrFromSevenZip, dialogItems, kNumDialogItems);
if (askCode != kOkButtonIndex)
return NFileOperationReturnCode::kInterruptedByUser;
destPath = dialogItems[kPathIndex].Data;
destPath.Trim();
if (destPath.IsEmpty())
{
if(!NFile::NDirectory::MyGetCurrentDirectory(destPath))
throw 318016;
NFile::NName::NormalizeDirPathPrefix(destPath);
break;
}
else
{
if(destPath[destPath.Length() - 1] == kDirDelimiter)
break;
}
g_StartupInfo.ShowMessage("You must specify directory path");
}
if (dialogItems[kPathModeRadioIndex].Selected)
extractionInfo.PathMode = NExtract::NPathMode::kFullPathnames;
else if (dialogItems[kPathModeRadioIndex + 1].Selected)
extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames;
else if (dialogItems[kPathModeRadioIndex + 2].Selected)
extractionInfo.PathMode = NExtract::NPathMode::kNoPathnames;
else
throw 31806;
if (dialogItems[kOverwriteModeRadioIndex].Selected)
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
else if (dialogItems[kOverwriteModeRadioIndex + 1].Selected)
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
else if (dialogItems[kOverwriteModeRadioIndex + 2].Selected)
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkipExisting;
else if (dialogItems[kOverwriteModeRadioIndex + 3].Selected)
extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRename;
else if (dialogItems[kOverwriteModeRadioIndex + 4].Selected)
示例7: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
#ifdef UNDER_CE
LPWSTR
#else
LPSTR
#endif
/* lpCmdLine */,int /* nCmdShow */)
{
g_hInstance = (HINSTANCE)hInstance;
NT_CHECK
// InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
UString executeFile, executeParameters;
#endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
FString fullPath;
NDLL::MyGetModuleFileName(fullPath);
switches.Trim();
bool assumeYes = false;
if (switches.Left(2).IsEqualToNoCase(L"-y"))
{
assumeYes = true;
switches = switches.Mid(2, switches.Len() - 2);
switches.Trim();
}
AString config;
if (!ReadDataString(fullPath, kStartID, kEndID, config))
{
if (!assumeYes)
ShowErrorMessageRes(IDS_CANT_LOAD_CONFIG_INFO); // 変更
return 1;
}
UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
UString appLaunched;
bool showProgress = true;
UString friendlyName; // 追加
UString installPrompt; // 追加
bool isInstaller; // 追加
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
if (!assumeYes)
ShowErrorMessageRes(IDS_CONFIG_FAILED); // 変更
return 1;
}
friendlyName = GetTextConfigValue(pairs, L"Title"); // 変更
installPrompt = GetTextConfigValue(pairs, L"BeginPrompt"); // 変更
isInstaller = GetTextConfigValue(pairs, L"IsInstaller").IsEqualToNoCase(L"yes"); // 追加
if (isInstaller) // 追加
{ // 追加
UString progress = GetTextConfigValue(pairs, L"Progress");
if (progress.IsEqualToNoCase(L"no"))
showProgress = false;
int index = FindTextConfigItem(pairs, L"Directory");
if (index >= 0)
dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
MB_ICONQUESTION) != IDYES)
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
#ifdef _SHELL_EXECUTE
executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters") + switches;
#endif
} // 追加
}
NFile::NDir::CTempDir tempDir;
/* 追加 */
UString tempDirPath;
if (isInstaller)
{
if (!tempDir.Create(kTempDirPrefix))
{
if (!assumeYes)
ShowErrorMessageRes(IDS_CANT_CREATE_TEMP_FOLDER);
return 1;
}
tempDirPath = GetUnicodeString(tempDir.GetPath());
}
else
{
tempDirPath = fullPath.Mid(0, fullPath.ReverseFind('\\') + 1);
if (!assumeYes)
{
//.........这里部分代码省略.........
示例8: GetFullKeyName
CSysString CStartupInfo::GetFullKeyName(const CSysString &keyName) const
{
return (keyName.IsEmpty()) ? m_RegistryPath:
(m_RegistryPath + kRegestryKeyDelimiter + keyName);
}
示例9: WinMain
int APIENTRY WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Disable current directory from being in the search path.
// This call does not help with implicitly loaded DLLs.
if (!RemoveCurrentDirFromSearchPath()) {
WCHAR minOSTitle[512] = { '\0' };
WCHAR minOSText[512] = { '\0' };
LoadStringW(NULL, IDS_MIN_OS_TITLE, minOSTitle,
sizeof(minOSTitle) / sizeof(minOSTitle[0]));
LoadStringW(NULL, IDS_MIN_OS_TEXT, minOSText,
sizeof(minOSText) / sizeof(minOSText[0]));
MessageBoxW(NULL, minOSText, minOSTitle, MB_OK | MB_ICONERROR);
return 1;
}
g_hInstance = (HINSTANCE)hInstance;
#ifndef _UNICODE
g_IsNT = IsItWindowsNT();
#endif
InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
UString executeFile, executeParameters;
#endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
UString fullPath;
NDLL::MyGetModuleFileName(g_hInstance, fullPath);
switches.Trim();
bool assumeYes = false;
if (switches.Left(2).CompareNoCase(UString(L"-y")) == 0)
{
assumeYes = true;
switches = switches.Mid(2);
switches.Trim();
}
/* BEGIN Mozilla customizations */
bool showProgress = true;
if (switches.Left(3).CompareNoCase(UString(L"-ms")) == 0 ||
switches.Left(4).CompareNoCase(UString(L"/INI")) == 0 ||
switches.Left(2).CompareNoCase(UString(L"/S")) == 0)
showProgress = false;
/* END Mozilla customizations */
AString config;
if (!ReadDataString(fullPath, kStartID, kEndID, config))
{
if (!assumeYes)
MyMessageBox(L"Can't load config info");
return 1;
}
UString dirPrefix = L".\\";
UString appLaunched;
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
if (!assumeYes)
MyMessageBox(L"Config failed");
return 1;
}
UString friendlyName = GetTextConfigValue(pairs, L"Title");
UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt");
UString progress = GetTextConfigValue(pairs, L"Progress");
if (progress.CompareNoCase(L"no") == 0)
showProgress = false;
int index = FindTextConfigItem(pairs, L"Directory");
if (index >= 0)
dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
MB_ICONQUESTION) != IDYES)
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
#ifdef _SHELL_EXECUTE
executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters") + switches;
#endif
}
NFile::NDirectory::CTempDirectory tempDir;
if (!tempDir.Create(kTempDirPrefix))
{
if (!assumeYes)
MyMessageBox(L"Can not create temp folder archive");
return 1;
}
//.........这里部分代码省略.........