Replace hard coded strings with resources

svn path=/trunk/; revision=68338
This commit is contained in:
Ged Murphy 2015-07-04 13:40:17 +00:00
parent 72127bd933
commit aeed3091c7
3 changed files with 33 additions and 23 deletions

View file

@ -811,6 +811,7 @@ CDeviceView::BuildContextMenuForNode(
MenuItemInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;
MenuItemInfo.fType = MFT_STRING;
CAtlStringW String;
int i = 0;
// Device nodes have extra data
@ -820,32 +821,36 @@ CDeviceView::BuildContextMenuForNode(
if (DeviceNode->CanUpdate())
{
String.LoadStringW(g_hInstance, IDS_MENU_UPDATE);
MenuItemInfo.wID = IDC_UPDATE_DRV;
MenuItemInfo.dwTypeData = L"Update driver software...";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->IsDisabled())
{
String.LoadStringW(g_hInstance, IDS_MENU_ENABLE);
MenuItemInfo.wID = IDC_ENABLE_DRV;
MenuItemInfo.dwTypeData = L"Enable";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->CanDisable() && !DeviceNode->IsDisabled())
{
String.LoadStringW(g_hInstance, IDS_MENU_DISABLE);
MenuItemInfo.wID = IDC_DISABLE_DRV;
MenuItemInfo.dwTypeData = L"Disable";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->CanUninstall())
{
String.LoadStringW(g_hInstance, IDS_MENU_UNINSTALL);
MenuItemInfo.wID = IDC_UNINSTALL_DRV;
MenuItemInfo.dwTypeData = L"Uninstall";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;
}
@ -855,8 +860,9 @@ CDeviceView::BuildContextMenuForNode(
}
// All nodes have the scan option
String.LoadStringW(g_hInstance, IDS_MENU_SCAN);
MenuItemInfo.wID = IDC_SCAN_HARDWARE;
MenuItemInfo.dwTypeData = L"Scan for hardware changes";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;
@ -865,8 +871,9 @@ CDeviceView::BuildContextMenuForNode(
InsertMenuItemW(hContextMenu, i, TRUE, &MenuSeperator);
i++;
String.LoadStringW(g_hInstance, IDS_MENU_PROPERTIES);
MenuItemInfo.wID = IDC_PROPERTIES;
MenuItemInfo.dwTypeData = L"Properties";
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(hContextMenu, i, TRUE, &MenuItemInfo);
i++;

View file

@ -43,6 +43,16 @@
/* General strings */
#define IDS_CONFIRM_DISABLE 400
/* Menu strings */
#define IDS_MENU_UPDATE 500
#define IDS_MENU_ENABLE 501
#define IDS_MENU_DISABLE 502
#define IDS_MENU_UNINSTALL 503
#define IDS_MENU_SCAN 504
#define IDS_MENU_ADD 505
#define IDS_MENU_PROPERTIES 506
/* menu hints */
#define IDS_HINT_BLANK 1000
#define IDS_HINT_PROPERTIES 1001

View file

@ -33,28 +33,21 @@ BEGIN
END
END
IDR_POPUP MENU
BEGIN
POPUP "popup"
BEGIN
MENUITEM "Update driver software..." IDC_UPDATE_DRV
MENUITEM "Enable" IDC_ENABLE_DRV
MENUITEM "Disable" IDC_DISABLE_DRV
MENUITEM "Uninstall" IDC_UNINSTALL_DRV
MENUITEM SEPARATOR
MENUITEM "Scan for hardware changes" IDC_SCAN_HARDWARE
MENUITEM "Add hardware" IDC_ADD_HARDWARE, GRAYED
MENUITEM SEPARATOR
MENUITEM "Properties", IDC_PROPERTIES
END
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_CONFIRM_DISABLE "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_MENU_UPDATE "Update driver software..."
IDS_MENU_ENABLE "Enable"
IDS_MENU_DISABLE "Disable"
IDS_MENU_UNINSTALL "Uninstall"
IDS_MENU_SCAN "Scan for hardware changes"
IDS_MENU_ADD "Add hardware"
IDS_MENU_PROPERTIES "Properties"
END
STRINGTABLE DISCARDABLE
BEGIN