]> repos.lx-s.de Git - winmute.git/commitdiff
A->W Windows APIs
authorlx-s <lx-s@users.noreply.github.com>
Tue, 23 Aug 2022 11:02:57 +0000 (13:02 +0200)
committerlx-s <lx-s@users.noreply.github.com>
Tue, 23 Aug 2022 11:02:57 +0000 (13:02 +0200)
WinMute/QuietHoursTimer.cpp
WinMute/WifiDetector.cpp
WinMute/WinMute.cpp

index ae6946ff075fe7c75db616475dcfa0e0cbac8846..d3dbe09c940e411c5bb4409ad1d50d28f4b05d4c 100644 (file)
@@ -95,11 +95,11 @@ static VOID CALLBACK QuietHoursTimerProc(HWND hWnd, UINT msg, UINT_PTR id, DWORD
    UNREFERENCED_PARAMETER(msSinceSysStart);
    if (id == QUIETHOURS_TIMER_START_ID) {
       KillTimer(hWnd, id);
-      SendMessage(hWnd, WM_WINMUTE_QUIETHOURS_START, 0, 0);
+      SendMessageW(hWnd, WM_WINMUTE_QUIETHOURS_START, 0, 0);
    }
    else if (id == QUIETHOURS_TIMER_END_ID) {
       KillTimer(hWnd, id);
-      SendMessage(hWnd, WM_WINMUTE_QUIETHOURS_END, 0, 0);
+      SendMessageW(hWnd, WM_WINMUTE_QUIETHOURS_END, 0, 0);
    }
 }
 
index 9c2640e415b2ed6b09abef8a885ffb0bcde38732..cf80571a1c2a2c07e7ff667bacc4804c201c4cfb 100644 (file)
@@ -154,8 +154,8 @@ void WifiDetector::WlanNotificationCallback(PWLAN_NOTIFICATION_DATA notifyData)
           || !isMuteList_ && it == std::end(networks_)) {
          size_t profileNameLen = lstrlen(wcnd->strProfileName);
          wchar_t* wiFiName = new wchar_t[profileNameLen + 1];
-         StringCchCopy(wiFiName, profileNameLen + 1, wcnd->strProfileName);
-         SendMessage(hNotifyWnd_, WM_WIFISTATUSCHANGED, connected,
+         StringCchCopyW(wiFiName, profileNameLen + 1, wcnd->strProfileName);
+         SendMessageW(hNotifyWnd_, WM_WIFISTATUSCHANGED, connected,
                       reinterpret_cast<LPARAM>(wiFiName));
       }
    }
index c679f11c2dc8484ff1d8390586ed685084ce32d9..7f7e6b7648cc11ffb199a4ccf2198d5c04717cb0 100644 (file)
@@ -56,7 +56,7 @@ static LRESULT CALLBACK WinMuteWndProc(
    switch (msg) {
    case WM_NCCREATE: {
       LPCREATESTRUCTW cs = reinterpret_cast<LPCREATESTRUCTW>(lParam);
-      SetWindowLongPtr(hWnd, GWLP_USERDATA,
+      SetWindowLongPtrW(hWnd, GWLP_USERDATA,
          reinterpret_cast<LONG_PTR>(cs->lpCreateParams));
       return TRUE;
    }
@@ -64,7 +64,7 @@ static LRESULT CALLBACK WinMuteWndProc(
       break;
    }
    return (wm) ? wm->WindowProc(hWnd, msg, wParam, lParam)
-      : DefWindowProc(hWnd, msg, wParam, lParam);
+      : DefWindowProcW(hWnd, msg, wParam, lParam);
 }
 
 static int IsDarkMode(bool& isDarkMode)
@@ -111,13 +111,13 @@ static bool IsCurrentSessionRemoteable()
       HKEY hRegKey = NULL;
       LONG lResult;
 
-      lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TERMINAL_SERVER_KEY, 0, KEY_READ, &hRegKey);
+      lResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TERMINAL_SERVER_KEY, 0, KEY_READ, &hRegKey);
       if (lResult == ERROR_SUCCESS) {
          DWORD dwGlassSessionId;
          DWORD cbGlassSessionId = sizeof(dwGlassSessionId);
          DWORD dwType;
 
-         lResult = RegQueryValueEx(hRegKey, GLASS_SESSION_ID, NULL, &dwType,
+         lResult = RegQueryValueExW(hRegKey, GLASS_SESSION_ID, NULL, &dwType,
             reinterpret_cast<BYTE*>(&dwGlassSessionId),
             &cbGlassSessionId);
 
@@ -170,7 +170,7 @@ bool WinMute::RegisterWindowClass()
 
 bool WinMute::InitWindow()
 {
-   hWnd_ = CreateWindowEx(WS_EX_TOOLWINDOW, WINMUTE_CLASS_NAME, PROGRAM_NAME,
+   hWnd_ = CreateWindowExW(WS_EX_TOOLWINDOW, WINMUTE_CLASS_NAME, PROGRAM_NAME,
       WS_POPUP, 0, 0, 0, 0, NULL, 0, hglobInstance, this);
    if (hWnd_ == nullptr) {
       PrintWindowsError(L"CreateWindowEx");
@@ -206,7 +206,7 @@ bool WinMute::InitAudio()
 bool WinMute::InitTrayMenu()
 {
    if (hTrayMenu_ == NULL) {
-      hTrayMenu_ = LoadMenu(hglobInstance, MAKEINTRESOURCE(IDR_TRAYMENU));
+      hTrayMenu_ = LoadMenuW(hglobInstance, MAKEINTRESOURCE(IDR_TRAYMENU));
       if (hTrayMenu_ == NULL) {
          PrintWindowsError(L"LoadMenu");
          return false;
@@ -229,7 +229,7 @@ bool WinMute::Init()
 {
    WMLog& log = WMLog::GetInstance();
 
-   hAppIcon_ = LoadIcon(hglobInstance, MAKEINTRESOURCE(IDI_APP));
+   hAppIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APP));
 
    if (!settings_.Init()) {
       return false;
@@ -280,7 +280,7 @@ bool WinMute::Init()
 
    bool isDarkMode = true;
    IsDarkMode(isDarkMode);
-   hTrayIcon_ = LoadIcon(
+   hTrayIcon_ = LoadIconW(
       hglobInstance,
       isDarkMode ? MAKEINTRESOURCE(IDI_TRAY_DARK)
                  : MAKEINTRESOURCE(IDI_TRAY_BRIGHT));
@@ -421,7 +421,7 @@ LRESULT CALLBACK WinMute::WindowProc(
          static bool dialogOpen = false;
          if (!dialogOpen) {
             dialogOpen = true;
-            if (DialogBoxParam(
+            if (DialogBoxParamW(
                   hglobInstance,
                   MAKEINTRESOURCE(IDD_SETTINGS),
                   hWnd_,
@@ -600,7 +600,7 @@ LRESULT CALLBACK WinMute::WindowProc(
          if (wParam == 1) { // Connected
             if (settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)) {
                wchar_t msgBuf[260] = { 0 };
-               wchar_t* wifiName = reinterpret_cast<wchar_t*>(lParam);
+               wchar_t *wifiName = reinterpret_cast<wchar_t*>(lParam);
                if (settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST)) {
                   StringCchPrintfW(
                      msgBuf, ARRAY_SIZE(msgBuf),