本文整理汇总了C++中CAtlStringW::LoadStringW方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlStringW::LoadStringW方法的具体用法?C++ CAtlStringW::LoadStringW怎么用?C++ CAtlStringW::LoadStringW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlStringW
的用法示例。
在下文中一共展示了CAtlStringW::LoadStringW方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
CDeviceView::EnableSelectedDevice(
_In_ bool Enable,
_Out_ bool &NeedsReboot
)
{
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
if (Node == nullptr) return false;
if (Enable == false)
{
CAtlStringW str;
if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
{
if (MessageBoxW(m_hMainWnd,
str,
Node->GetDisplayName(),
MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
{
return false;
}
}
}
return Node->EnableDevice(Enable, NeedsReboot);
}
示例2: sizeof
void
CDeviceView::BuildActionMenuForNode(
_In_ HMENU OwnerMenu,
_In_ CNode *Node,
_In_ bool MainMenu
)
{
// Create a seperator structure
MENUITEMINFOW MenuSeperator = { 0 };
MenuSeperator.cbSize = sizeof(MENUITEMINFOW);
MenuSeperator.fType = MFT_SEPARATOR;
// Setup the
MENUITEMINFOW MenuItemInfo = { 0 };
MenuItemInfo.cbSize = sizeof(MENUITEMINFOW);
MenuItemInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;
MenuItemInfo.fType = MFT_STRING;
CAtlStringW String;
int i = 0;
// Device nodes have extra data
if (Node->GetNodeType() == DeviceNode)
{
CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
if (DeviceNode->CanUpdate())
{
String.LoadStringW(g_hThisInstance, IDS_MENU_UPDATE);
MenuItemInfo.wID = IDC_UPDATE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->IsDisabled())
{
String.LoadStringW(g_hThisInstance, IDS_MENU_ENABLE);
MenuItemInfo.wID = IDC_ENABLE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->CanDisable() && !DeviceNode->IsDisabled())
{
String.LoadStringW(g_hThisInstance, IDS_MENU_DISABLE);
MenuItemInfo.wID = IDC_DISABLE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (DeviceNode->CanUninstall())
{
String.LoadStringW(g_hThisInstance, IDS_MENU_UNINSTALL);
MenuItemInfo.wID = IDC_UNINSTALL_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
}
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
i++;
}
// All nodes have the scan option
String.LoadStringW(g_hThisInstance, IDS_MENU_SCAN);
MenuItemInfo.wID = IDC_SCAN_HARDWARE;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
if ((Node->GetNodeType() == RootNode) || (MainMenu == true))
{
String.LoadStringW(g_hThisInstance, IDS_MENU_ADD);
MenuItemInfo.wID = IDC_ADD_HARDWARE;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
}
if (Node->HasProperties())
{
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
i++;
String.LoadStringW(g_hThisInstance, IDS_MENU_PROPERTIES);
MenuItemInfo.wID = IDC_PROPERTIES;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
i++;
SetMenuDefaultItem(OwnerMenu, IDC_PROPERTIES, FALSE);
}
}