diff --git a/tray/include/core/windows/tray.hpp b/tray/include/core/windows/tray.hpp index ab5949922b41c519a6632544286811f379f36392..6f658feda1aae2c1770648b3bffc3af201672fe6 100755 --- a/tray/include/core/windows/tray.hpp +++ b/tray/include/core/windows/tray.hpp @@ -11,7 +11,7 @@ namespace Tray { HWND hwnd = nullptr; HMENU menu = nullptr; - WNDCLASSEX windowClass; + WNDCLASSEXA windowClass; NOTIFYICONDATA notifyData; std::vector> allocations; diff --git a/tray/src/core/windows/image.cpp b/tray/src/core/windows/image.cpp index 75a7868350bd1069521345826163eb9275607277..1ecb1de7edaeaff871426238862531dcf4015a76 100755 --- a/tray/src/core/windows/image.cpp +++ b/tray/src/core/windows/image.cpp @@ -5,7 +5,7 @@ Tray::Image::Image(HBITMAP image) : image(image) {} Tray::Image::Image(const char *path) : Image(std::string(path)) {} Tray::Image::Image(const std::string &path) - : image(reinterpret_cast(LoadImage(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))) + : image(reinterpret_cast(LoadImageA(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))) { if (image == nullptr) { diff --git a/tray/src/core/windows/tray.cpp b/tray/src/core/windows/tray.cpp index 38111083207e3e9512f24749360172b995cf2bb0..8d9326b5d700b91c81ba0aef7d8dfcea1c9e19ca 100755 --- a/tray/src/core/windows/tray.cpp +++ b/tray/src/core/windows/tray.cpp @@ -23,14 +23,14 @@ Tray::Tray::Tray(std::string identifier, Icon icon) : BaseTray(std::move(identif windowClass.lpszClassName = this->identifier.c_str(); windowClass.hInstance = GetModuleHandle(nullptr); - if (RegisterClassEx(&windowClass) == 0) + if (RegisterClassExA(&windowClass) == 0) { throw std::runtime_error("Failed to register class"); } // NOLINTNEXTLINE - hwnd = CreateWindow(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance, - nullptr); + hwnd = CreateWindowA(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance, + nullptr); if (hwnd == nullptr) { throw std::runtime_error("Failed to create window"); @@ -64,7 +64,7 @@ void Tray::Tray::exit() DestroyIcon(notifyData.hIcon); DestroyMenu(menu); - UnregisterClass(identifier.c_str(), GetModuleHandle(nullptr)); + UnregisterClassA(identifier.c_str(), GetModuleHandle(nullptr)); PostMessage(hwnd, WM_QUIT, 0, 0); allocations.clear(); @@ -97,11 +97,11 @@ HMENU Tray::Tray::construct(const std::vector> &entri { auto *item = entry.get(); - auto name = std::shared_ptr(new char[item->getText().size() + 1]); - strcpy(name.get(), item->getText().c_str()); // NOLINT + auto name = std::make_shared(item->getText().size() + 1); + strcpy_s(name.get(), item->getText().size() + 1, item->getText().c_str()); // NOLINT parent->allocations.emplace_back(name); - MENUITEMINFO winItem{0}; + MENUITEMINFOA winItem{0}; winItem.wID = ++id; winItem.dwTypeData = name.get(); @@ -158,7 +158,7 @@ HMENU Tray::Tray::construct(const std::vector> &entri } } - InsertMenuItem(menu, id, TRUE, &winItem); + InsertMenuItemA(menu, id, TRUE, &winItem); } return menu;