Replace StringCbPrintf() with StrFormat() (PR #1032)

This commit is contained in:
Kelvin Lee
2022-02-16 05:48:20 +11:00
committed by GitHub
parent 48dd638d33
commit 1a4e933778
16 changed files with 103 additions and 147 deletions
+4 -5
View File
@@ -65,13 +65,12 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hWnd, UINT message, WPARAM wparam, LPA
case WM_INITDIALOG:
{
HICON hIcon = LoadIcon(GetFrame().g_hInstance, TEXT("APPLEWIN_ICON"));
SendDlgItemMessage(hWnd, IDC_APPLEWIN_ICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
SendDlgItemMessage(hWnd, IDC_APPLEWIN_ICON, STM_SETIMAGE, IMAGE_ICON, reinterpret_cast<LPARAM>(hIcon));
TCHAR szAppleWinVersion[50];
StringCbPrintf(szAppleWinVersion, 50, "AppleWin v%s", VERSIONSTRING);
SendDlgItemMessage(hWnd, IDC_APPLEWIN_VERSION, WM_SETTEXT, 0, (LPARAM)szAppleWinVersion);
std::string strAppleWinVersion = "AppleWin v" + g_VERSIONSTRING;
SendDlgItemMessage(hWnd, IDC_APPLEWIN_VERSION, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(strAppleWinVersion.c_str()));
SendDlgItemMessage(hWnd, IDC_GPL_TEXT, WM_SETTEXT, 0, (LPARAM)g_szGPL);
SendDlgItemMessage(hWnd, IDC_GPL_TEXT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(g_szGPL));
}
break;
}
+5 -5
View File
@@ -476,7 +476,6 @@ void CPageDisk::HandleHDDSwap(HWND hWnd)
UINT CPageDisk::RemovalConfirmation(UINT uCommand)
{
TCHAR szText[100];
bool bMsgBox = true;
bool isDisk = false;
@@ -492,18 +491,19 @@ UINT CPageDisk::RemovalConfirmation(UINT uCommand)
drive = uCommand - IDC_COMBO_DISK1_SLOT5;
}
std::string strText;
if (isDisk)
StringCbPrintf(szText, sizeof(szText), "Do you really want to eject the disk in drive-%c ?", '1' + drive);
strText = StrFormat("Do you really want to eject the disk in drive-%c ?", '1' + drive);
else if (uCommand == IDC_COMBO_HDD1 || uCommand == IDC_COMBO_HDD2)
StringCbPrintf(szText, sizeof(szText), "Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
strText = StrFormat("Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
else if (uCommand == IDC_HDD_SWAP)
StringCbPrintf(szText, sizeof(szText), "Do you really want to swap the harddisk images?");
strText = "Do you really want to swap the harddisk images?";
else
bMsgBox = false;
if (bMsgBox)
{
int nRes = GetFrame().FrameMessageBox(szText, "Eject/Unplug Warning", MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);
int nRes = GetFrame().FrameMessageBox(strText.c_str(), "Eject/Unplug Warning", MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);
if (nRes == IDNO)
uCommand = 0;
}