1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] produce a sound and flash taskbar icon on success/error

* Closes #973
This commit is contained in:
Pete Batard 2017-07-04 14:51:25 +01:00
parent bfecb9e29f
commit 92d046e663
4 changed files with 28 additions and 6 deletions

View file

@ -121,7 +121,7 @@ RUFUS_UPDATE update = { {0,0,0}, {0,0}, NULL, NULL};
StrArray DriveID, DriveLabel;
extern char* szStatusMessage;
static HANDLE format_thid = NULL;
static HANDLE format_thid = NULL, dialog_handle = NULL;
static HWND hBoot = NULL, hSelectISO = NULL, hStart = NULL;
static HICON hIconDisc, hIconDown, hIconUp, hIconLang;
static char szTimer[12] = "00:00:00";
@ -1745,6 +1745,8 @@ static void InitDialog(HWND hDlg)
rufus_version[0], rufus_version[1], rufus_version[2]);
}
SetWindowTextU(hDlg, tmp);
// Now that we have a title, we can find the handle of our Dialog
dialog_handle = FindWindowA(NULL, tmp);
uprintf(APPLICATION_NAME " version: %d.%d.%d%s%s", rufus_version[0], rufus_version[1], rufus_version[2],
IsAlphaOrBeta(), (ini_file != NULL)?"(Portable)":"");
for (i=0; i<ARRAYSIZE(resource); i++) {
@ -2817,6 +2819,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000);
SetTaskbarProgressState(TASKBAR_NOPROGRESS);
PrintInfo(0, MSG_210);
MessageBeep(MB_OK);
FlashTaskbar(dialog_handle);
} else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) {
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0);
SetTaskbarProgressState(TASKBAR_PAUSED);
@ -2827,6 +2831,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SetTaskbarProgressState(TASKBAR_ERROR);
PrintInfo(0, MSG_212);
Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE)));
MessageBeep(MB_ICONERROR);
FlashTaskbar(dialog_handle);
}
FormatStatus = 0;
format_op_in_progress = FALSE;

View file

@ -502,6 +502,7 @@ extern BOOL SetFormatPromptHook(void);
extern void ClrFormatPromptHook(void);
extern BOOL SearchProcess(char* HandleName, BOOL bPartialMatch, BOOL bIgnoreSelf);
extern BOOL EnablePrivileges(void);
extern void FlashTaskbar(HANDLE handle);
DWORD WINAPI FormatThread(void* param);
DWORD WINAPI SaveImageThread(void* param);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.15.1121"
CAPTION "Rufus 2.15.1122"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,15,1121,0
PRODUCTVERSION 2,15,1121,0
FILEVERSION 2,15,1122,0
PRODUCTVERSION 2,15,1122,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.15.1121"
VALUE "FileVersion", "2.15.1122"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.15.1121"
VALUE "ProductVersion", "2.15.1122"
END
END
BLOCK "VarFileInfo"

View file

@ -1856,6 +1856,21 @@ void ClrFormatPromptHook(void) {
fp_weh = NULL;
}
void FlashTaskbar(HANDLE handle)
{
FLASHWINFO pf;
if (handle == NULL)
return;
pf.cbSize = sizeof(FLASHWINFO);
pf.hwnd = handle;
// Could also use FLASHW_ALL to flash the main dialog)
pf.dwFlags = FLASHW_TIMER | FLASHW_TRAY;
pf.uCount = 5;
pf.dwTimeout = 75;
FlashWindowEx(&pf);
}
#ifdef RUFUS_TEST
static __inline LPWORD lpwAlign(LPWORD addr)
{