mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
Replaced some constants with resources
Something's not working
This commit is contained in:
parent
2ec2725f48
commit
382a4be84b
@ -2,16 +2,6 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// Localizable constants, these should be converted to resources
|
||||
namespace constants::localizable
|
||||
{
|
||||
// Text shown in the context menu
|
||||
constexpr WCHAR CommandTitle[] = L"What's using this file?";
|
||||
|
||||
// Localized name of this PowerToy
|
||||
constexpr WCHAR PowerToyName[] = L"File Locksmith";
|
||||
}
|
||||
|
||||
// Non-localizable constants
|
||||
namespace constants::nonlocalizable
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Settings.h"
|
||||
#include "dllmain.h"
|
||||
#include "Trace.h"
|
||||
#include "../FileLocksmithLib/Generated Files/resource.h"
|
||||
|
||||
// Implementations of inherited IUnknown methods
|
||||
|
||||
@ -38,7 +39,9 @@ IFACEMETHODIMP_(ULONG) ExplorerCommand::Release()
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetTitle(IShellItemArray* psiItemArray, LPWSTR* ppszName)
|
||||
{
|
||||
return SHStrDup(constants::localizable::CommandTitle, ppszName);
|
||||
WCHAR buffer[128];
|
||||
LoadStringW(globals::instance, IDS_FILELOCKSMITH_COMMANDTITLE, buffer, ARRAYSIZE(buffer));
|
||||
return SHStrDupW(buffer, ppszName);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetIcon(IShellItemArray* psiItemArray, LPWSTR* ppszIcon)
|
||||
@ -118,7 +121,7 @@ IFACEMETHODIMP ExplorerCommand::QueryContextMenu(HMENU hmenu, UINT indexMenu, UI
|
||||
mii.wID = idCmdFirst++;
|
||||
mii.fType = MFT_STRING;
|
||||
|
||||
hr = SHStrDupW(constants::localizable::CommandTitle, &mii.dwTypeData);
|
||||
hr = GetTitle(NULL, &mii.dwTypeData);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "dllmain.h"
|
||||
#include "Settings.h"
|
||||
#include "Trace.h"
|
||||
#include "../FileLocksmithLib/Generated Files/resource.h"
|
||||
|
||||
class FileLocksmithModule : public PowertoyModuleIface
|
||||
{
|
||||
@ -22,7 +23,9 @@ public:
|
||||
|
||||
virtual const wchar_t* get_name() override
|
||||
{
|
||||
return constants::localizable::PowerToyName;
|
||||
static WCHAR buffer[128];
|
||||
LoadStringW(globals::instance, IDS_FILELOCKSMITH_POWERTOYNAME, buffer, ARRAYSIZE(buffer));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
virtual const wchar_t* get_key() override
|
||||
|
Loading…
Reference in New Issue
Block a user