From 48517b7c9bed057dbd3afffdbb20cd12117dcabb Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Aurimas=20Fi=C5=A1eras?= Date: Wed, 24 Jun 2009 15:39:19 +0300 Subject: taskmgr: Make MessageBoxes translatable --- programs/taskmgr/En.rc | 21 +++++++++++++++++++++ programs/taskmgr/affinity.c | 18 ++++++++---------- programs/taskmgr/debug.c | 18 ++++++++---------- programs/taskmgr/endproc.c | 17 ++++++++++++++--- programs/taskmgr/priority.c | 11 +++++++---- programs/taskmgr/resource.h | 10 ++++++++++ 6 files changed, 68 insertions(+), 27 deletions(-) diff --git a/programs/taskmgr/En.rc b/programs/taskmgr/En.rc index d824fd3..fc99c31 100644 --- a/programs/taskmgr/En.rc +++ b/programs/taskmgr/En.rc @@ -533,3 +533,24 @@ BEGIN IDS_IOOTHER "I/O Other" IDS_IOOTHERBYTES "I/O Other Bytes" END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WARNING_TITLE "Task Manager Warning" + IDS_PRIORITY_CHANGE_MESSAGE "WARNING: Changing the priority class of this process may\n\ + cause undesired results including system instability. Are you\n\ + sure you want to change the priority class?" + IDS_PRIORITY_UNABLE2CHANGE "Unable to Change Priority" + IDS_TERMINATE_MESSAGE "WARNING: Terminating a process can cause undesired\n\ + results including loss of data and system instability. The\n\ + process will not be given the chance to save its state or\n\ + data before it is terminated. Are you sure you want to\n\ + terminate the process?" + IDS_TERMINATE_UNABLE2TERMINATE "Unable to Terminate Process" + IDS_DEBUG_MESSAGE "WARNING: Debugging this process may result in loss of data.\n\ + Are you sure you wish to attach the debugger?" + IDS_DEBUG_UNABLE2DEBUG "Unable to Debug Process" + IDS_AFFINITY_ERROR_MESSAGE "The process must have affinity with at least one processor" + IDS_AFFINITY_ERROR_TITLE "Invalid Option" + IDS_AFFINITY_UNABLE2ACCESS "Unable to Access or Set Process Affinity" +END diff --git a/programs/taskmgr/affinity.c b/programs/taskmgr/affinity.c index 31a4f64..38dbe7e 100644 --- a/programs/taskmgr/affinity.c +++ b/programs/taskmgr/affinity.c @@ -35,10 +35,7 @@ HANDLE hProcessAffinityHandle; -static const WCHAR wszUnable2Access[] = {'U','n','a','b','l','e',' ','t','o',' ', - 'A','c','c','e','s','s',' ','o','r',' ', - 'S','e','t',' ','P','r','o','c','e','s','s',' ', - 'A','f','f','i','n','i','t','y',0}; +WCHAR wszUnable2Access[255]; static INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -57,6 +54,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) { GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); EndDialog(hDlg, 0); + LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); } @@ -292,12 +290,10 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * of it's cpu time. */ if (!dwProcessAffinityMask) { - static const WCHAR wszErrorMsg[] = {'T','h','e',' ','p','r','o','c','e','s','s',' ', - 'm','u','s','t',' ','h','a','v','e',' ', - 'a','f','f','i','n','i','t','y',' ', - 'w','i','t','h',' ','a','t',' ','l','e','a','s','t',' ', - 'o','n','e',' ','p','r','o','c','e','s','s','o','r','.',0}; - static const WCHAR wszErrorTitle[] = {'I','n','v','a','l','i','d',' ','O','p','t','i','o','n',0}; + WCHAR wszErrorMsg[255]; + WCHAR wszErrorTitle[255]; + LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, sizeof(wszErrorMsg)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, sizeof(wszErrorTitle)/sizeof(WCHAR)); MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP); return TRUE; } @@ -308,6 +304,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) { GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); EndDialog(hDlg, LOWORD(wParam)); + LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); } @@ -343,6 +340,7 @@ void ProcessPage_OnSetAffinity(void) hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId); if (!hProcessAffinityHandle) { GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); return; } diff --git a/programs/taskmgr/debug.c b/programs/taskmgr/debug.c index 409a337..cbd3ebf 100644 --- a/programs/taskmgr/debug.c +++ b/programs/taskmgr/debug.c @@ -47,22 +47,20 @@ void ProcessPage_OnDebug(void) STARTUPINFOW si; HANDLE hDebugEvent; - static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ', - 'W','a','r','n','i','n','g',0}; - static const WCHAR wszUnable2Debug[] = {'U','n','a','b','l','e',' ','t','o',' ','D','e','b','u','g',' ', - 'P','r','o','c','e','s','s',0}; + WCHAR wszWarnTitle[255]; + WCHAR wszUnable2Debug[255]; + WCHAR wszWarnMsg[255]; + static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\', 'M','i','c','r','o','s','o','f','t','\\', 'W','i','n','d','o','w','s',' ','N','T','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'A','e','D','e','b','u','g',0}; static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0}; - static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','D','e','b','u','g','g','i','n','g',' ', - 't','h','i','s',' ','p','r','o','c','e','s','s',' ','m','a','y',' ', - 'r','e','s','u','l','t',' ','i','n',' ','l','o','s','s',' ','o','f',' ', - 'd','a','t','a','.','\n','A','r','e',' ','y','o','u',' ','s','u','r','e',' ', - 'y','o','u',' ','w','i','s','h',' ','t','o',' ','a','t','t','a','c','h',' ', - 't','h','e',' ','d','e','b','u','g','g','e','r','?',0}; + + LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, sizeof(wszUnable2Debug)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { diff --git a/programs/taskmgr/endproc.c b/programs/taskmgr/endproc.c index 241aa67..5129ec3 100644 --- a/programs/taskmgr/endproc.c +++ b/programs/taskmgr/endproc.c @@ -33,9 +33,16 @@ #include "taskmgr.h" #include "perfdata.h" -static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','T','e','r','m','i','n','a','t','i','n','g',' ','a',' ','p','r','o','c','e','s','s',' ','c','a','n',' ','c','a','u','s','e',' ','u','n','d','e','s','i','r','e','d','\n','r','e','s','u','l','t','s',' ','i','n','c','l','u','d','i','n','g',' ','l','o','s','s',' ','o','f',' ','d','a','t','a',' ','a','n','d',' ','s','y','s','t','e','m',' ','i','n','s','t','a','b','i','l','i','t','y','.',' ','T','h','e','\n','p','r','o','c','e','s','s',' ','w','i','l','l',' ','n','o','t',' ','b','e',' ','g','i','v','e','n',' ','t','h','e',' ','c','h','a','n','c','e',' ','t','o',' ','s','a','v','e',' ','i','t','s',' ','s','t','a','t','e',' ','o','r','\n','d','a','t','a',' ','b','e','f','o','r','e',' ','i','t',' ','i','s',' ','t','e','r','m','i','n','a','t','e','d','.',' ','A','r','e',' ','y','o','u',' ','s','u','r','e',' ','y','o','u',' ','w','a','n','t',' ','t','o','\n','t','e','r','m','i','n','a','t','e',' ','t','h','e',' ','p','r','o','c','e','s','s','?',0}; -static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ','W','a','r','n','i','n','g',0}; -static const WCHAR wszUnable2Terminate[] = {'U','n','a','b','l','e',' ','t','o',' ','T','e','r','m','i','n','a','t','e',' ','P','r','o','c','e','s','s',0}; +WCHAR wszWarnMsg[511]; +WCHAR wszWarnTitle[255]; +WCHAR wszUnable2Terminate[255]; + +static void load_message_strings(void) +{ + LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, sizeof(wszUnable2Terminate)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); +} void ProcessPage_OnEndProcess(void) { @@ -45,6 +52,8 @@ void ProcessPage_OnEndProcess(void) HANDLE hProcess; WCHAR wstrErrorText[256]; + load_message_strings(); + for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { lvitem.mask = LVIF_STATE; @@ -92,6 +101,8 @@ void ProcessPage_OnEndProcessTree(void) HANDLE hProcess; WCHAR wstrErrorText[256]; + load_message_strings(); + for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { lvitem.mask = LVIF_STATE; diff --git a/programs/taskmgr/priority.c b/programs/taskmgr/priority.c index 360fe16..1a5ea37 100644 --- a/programs/taskmgr/priority.c +++ b/programs/taskmgr/priority.c @@ -41,10 +41,13 @@ static void DoSetPriority(DWORD priority) HANDLE hProcess; WCHAR wstrErrorText[256]; - static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','C','h','a','n','g','i','n','g', -' ','t','h','e',' ','p','r','i','o','r','i','t','y',' ','c','l','a','s','s',' ','o','f',' ','t','h','i','s',' ','p','r','o','c','e','s','s',' ','m','a','y','\n','c','a','u','s','e',' ','u','n','d','e','s','i','r','e','d',' ','r','e','s','u','l','t','s',' ','i','n','c','l','u','d','i','n','g',' ','s','y','s','t','e','m',' ','i','n','s','t','a','b','i','l','i','t','y','.',' ','A','r','e',' ','y','o','u','\n','s','u','r','e',' ','y','o','u',' ','w','a','n','t',' ','t','o',' ','c','h','a','n','g','e',' ','t','h','e',' ','p','r','i','o','r','i','t','y',' ','c','l','a','s','s','?',0}; - static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ','W','a','r','n','i','n','g',0}; - static const WCHAR wszUnable2Change[] = {'U','n','a','b','l','e',' ','t','o',' ','C','h','a','n','g','e',' ','P','r','i','o','r','i','t','y',0}; + WCHAR wszWarnMsg[255]; + WCHAR wszWarnTitle[255]; + WCHAR wszUnable2Change[255]; + + LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); + LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, sizeof(wszUnable2Change)/sizeof(WCHAR)); for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { diff --git a/programs/taskmgr/resource.h b/programs/taskmgr/resource.h index 9bf71d7..236f848 100644 --- a/programs/taskmgr/resource.h +++ b/programs/taskmgr/resource.h @@ -223,6 +223,16 @@ #define IDS_IOWRITEBYTES 32854 #define IDS_IOOTHER 32855 #define IDS_IOOTHERBYTES 32856 +#define IDS_WARNING_TITLE 32857 +#define IDS_PRIORITY_CHANGE_MESSAGE 32858 +#define IDS_PRIORITY_UNABLE2CHANGE 32859 +#define IDS_TERMINATE_MESSAGE 32860 +#define IDS_TERMINATE_UNABLE2TERMINATE 32861 +#define IDS_DEBUG_MESSAGE 32862 +#define IDS_DEBUG_UNABLE2DEBUG 32863 +#define IDS_AFFINITY_ERROR_MESSAGE 32864 +#define IDS_AFFINITY_ERROR_TITLE 32865 +#define IDS_AFFINITY_UNABLE2ACCESS 32866 #define IDC_STATIC -1 /* -- 1.6.3.1