本文整理汇总了C++中ActionStatus::GetErrorCode方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionStatus::GetErrorCode方法的具体用法?C++ ActionStatus::GetErrorCode怎么用?C++ ActionStatus::GetErrorCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionStatus
的用法示例。
在下文中一共展示了ActionStatus::GetErrorCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowSettingsDialog
int ShowSettingsDialog()
{
ActionStatus status;
RegistryKey key(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\BazisVirtualCDBus\\Parameters"), 0, true, &status);
if (!key.Valid() && (status.GetErrorCode() == AccessDenied))
{
TCHAR tsz[MAX_PATH + 2] = {0,};
tsz[0] = '\"';
GetModuleFileName(GetModuleHandle(0), tsz + 1, _countof(tsz) - 1);
size_t len = _tcslen(tsz);
tsz[len] = '\"';
tsz[len + 1] = 0;
return (int)CUACInvokerDialog(tsz).DoModal();
}
else
{
CSettingsDialog dlg;
dlg.DoModal();
}
return 0;
}
示例2: AppMain
int AppMain()
{
int argc;
LPCWSTR lpCmdLine = GetCommandLineW();
LPWSTR *ppArgv = CommandLineToArgvW(lpCmdLine, &argc);
LPCWSTR lpDiskPath = NULL;
bool ShowSettingsDialog = false, ForceMountOptions = false, AdminModeOnNetworkShare = false;
bool bDisableUAC = false;
char DriveLetterToRemount = 0;
BazisLib::String tmpString;
for (int i = 1; i < argc; i++)
{
if (ppArgv[i][0] != '/')
{
if (!lpDiskPath)
lpDiskPath = ppArgv[i];
}
else
{
if (!_wcsicmp(ppArgv[i], L"/settings"))
ShowSettingsDialog = true;
else if (!_wcsicmp(ppArgv[i], L"/ltrselect"))
ForceMountOptions = true;
else if (!_wcsicmp(ppArgv[i], L"/uac_on_network_share"))
AdminModeOnNetworkShare = true;
else if (!_wcsicmp(ppArgv[i], L"/uacdisable"))
bDisableUAC = true;
else if (!_wcsicmp(ppArgv[i], L"/createiso") || !_wcsicmp(ppArgv[i], L"/isofromfolder"))
{
if (argc < (i + 2))
{
MessageBox(HWND_DESKTOP, _TR(IDS_BADCMDLINE, "Invalid command line!"), NULL, MB_ICONERROR);
return 1;
}
ActionStatus st;
if (!_wcsicmp(ppArgv[i], L"/isofromfolder"))
{
wchar_t *pwszFolder = ppArgv[i + 1];
if (pwszFolder[0] && pwszFolder[wcslen(pwszFolder) - 1] == '\"')
pwszFolder[wcslen(pwszFolder) - 1] = '\\';
st = BuildISOFromFolder(pwszFolder);
}
else
st = CreateISOFile(ppArgv[i + 1]);
if (!st.Successful() && st.GetErrorCode() != OperationAborted)
MessageBox(HWND_DESKTOP, st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
return !st.Successful();
}
else if (!_wcsnicmp(ppArgv[i], L"/remount:", 9))
DriveLetterToRemount = (char)ppArgv[i][9];
}
}
if (bDisableUAC)
{
RegistryKey driverParametersKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\BazisVirtualCDBus\\Parameters"));
int prevVal = driverParametersKey[_T("GrantAccessToEveryone")];
int newVal = 1;
driverParametersKey[_T("GrantAccessToEveryone")] = newVal;
if (prevVal != newVal)
VirtualCDClient::RestartDriver();
return 0;
}
if (GetKeyState(VK_SHIFT) & (1 << 31))
ForceMountOptions = true;
if (!lpDiskPath && DriveLetterToRemount)
{
const TCHAR *pwszFilter = _TR(IDS_ISOFILTER, "ISO images (*.iso)|*.iso|All files (*.*)|*.*");
TCHAR tszFilter[128] = { 0, };
_tcsncpy(tszFilter, pwszFilter, _countof(tszFilter) - 1);
for (size_t i = 0; i < _countof(tszFilter); i++)
if (tszFilter[i] == '|')
tszFilter[i] = '\0';
CFileDialog dlg(true, _T("iso"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, tszFilter);
dlg.m_ofn.lpstrTitle = _TR(IDS_MOUNTIMAGE, "Mount a disc image");
if (dlg.DoModal() != IDOK)
return 1;
tmpString.assign(dlg.m_szFileName);
lpDiskPath = tmpString.c_str();
}
if ((argc < 2) || !ppArgv || !lpDiskPath || ShowSettingsDialog)
{
return ::ShowSettingsDialog();
}
MMCProfile detectedProfile = mpInvalid;
bool bFileOnNetworkShare = false;
{
//.........这里部分代码省略.........
示例3: OnTimer
LRESULT CISOProgressDialog::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
extern bool AutorunErrorHandler(ActionStatus st);
BackgroundDriveReader::ProgressRecord progress = m_pReader->GetProgress();
unsigned progressVal = (unsigned)((progress.Done * kProgressRangeMax) / progress.Total);
if (progress.TotalBad)
{
if (m_pTaskbar)
m_pTaskbar->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
m_ProgressBar.SetPos((int)((progress.ProcessedBad * kProgressRangeMax) / progress.TotalBad));
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTORPROGRESSFMT, "Re-reading bad sectors (%d/%d)"), (int)progress.ProcessedBad, (int)progress.TotalBad).c_str());
}
else
{
if (m_pTaskbar)
m_pTaskbar->SetProgressValue(m_hWnd, progress.Done, progress.Total);
m_ProgressBar.SetPos(progressVal);
unsigned badSectorCount = m_pReader->GetTotalBadSectorCount();
if (!badSectorCount)
{
bool remainingTimeAccurate = false;
TimeSpan remainingTime = m_pReader->GetEstimatedRemainingTime(&remainingTimeAccurate);
String label = String::sFormat(_TR(IDS_SPEEDSTATFMT, "Average read speed: %s/s"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str());
if (remainingTimeAccurate && (remainingTime.GetTotalSeconds() > 3))
label += String::sFormat(_TR(IDS_REMAININGTIMESUFFIX, ", remaining time: %02d:%02d"), remainingTime.GetTotalMinutes(), remainingTime.GetSeconds());
SetDlgItemText(IDC_PROGRESSLINE, label.c_str());
}
else
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTFMT, "Average read speed: %s/s, %d bad sector(s) found"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str(), badSectorCount).c_str());
}
if (m_pReader->QueryStatus().GetErrorCode() != Pending)
{
KillTimer(0);
::EnableWindow(GetDlgItem(IDC_PAUSE), FALSE);
ActionStatus st = m_pReader->QueryStatus();
if (st.Successful())
{
FunctionThread ejectThread(&EjectDriveProc, (PVOID)m_pReader->GetSourcePath());
if (SendDlgItemMessage(IDC_EJECTDISC, BM_GETCHECK) == BST_CHECKED)
ejectThread.Start();
if (SendDlgItemMessage(IDC_OPENFOLDER, BM_GETCHECK) == BST_CHECKED)
Win32::Process(Path::GetDirectoryName(ConstString(m_pReader->GetImagePath())).c_str(), _T("open"));
if (SendDlgItemMessage(IDC_MOUNTISO, BM_GETCHECK) == BST_CHECKED)
{
wchar_t wszKernelPath[512];
if (!VirtualCDClient::Win32FileNameToKernelFileName(m_pReader->GetImagePath(), wszKernelPath, __countof(wszKernelPath)))
MessageBox(_TR(IDS_BADIMGFN, "Invalid image file name!"), NULL, MB_ICONERROR);
else
{
TCHAR tsz[3] = {0,};
if (m_cbLetters.GetLBTextLen(m_cbLetters.GetCurSel()) < _countof(tsz))
m_cbLetters.GetLBText(m_cbLetters.GetCurSel(), tsz);
VirtualCDClient().ConnectDisk(wszKernelPath, (char)(tsz[0]), 0, m_RegParams.DisableAutorun, false, AutorunErrorHandler);
}
}
ejectThread.Join();
if (SendDlgItemMessage(IDC_CLOSEWINDOW, BM_GETCHECK) == BST_CHECKED)
{
EndDialog(IDOK);
SaveParams();
}
else
{
SetDlgItemText(IDCANCEL, _TR(IDS_CLOSE, "Close"));
m_ProgressBar.SetPos(kProgressRangeMax);
::SetFocus(GetDlgItem(IDCANCEL));
MessageBox(_TR(IDS_ISOCREATED, "The ISO image has been created successfully"), _TR(IDS_INFORMATION, "Information"), MB_ICONINFORMATION);
}
}
else
{
if (st.GetErrorCode() != OperationAborted)
MessageBox(st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
DeleteFile(m_pReader->GetImagePath());
EndDialog(IDNO);
}
}
return 0;
}