From b855b0d624d0348b86f5885153ba3a92c5986331 Mon Sep 17 00:00:00 2001 From: dreamforceinc Date: Tue, 7 Nov 2023 17:55:47 +0300 Subject: [PATCH] Changed calling updater thread. --- wCenterWindow/updater.cpp | 6 ++++-- wCenterWindow/updater.h | 3 ++- wCenterWindow/wCenterWindow.cpp | 4 +++- wCenterWindow/wCenterWindow.h | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wCenterWindow/updater.cpp b/wCenterWindow/updater.cpp index 9b4f64d..97b6904 100644 --- a/wCenterWindow/updater.cpp +++ b/wCenterWindow/updater.cpp @@ -26,7 +26,8 @@ void FillVersionStructure(Version& ver, const std::wstring& str); std::vector Split(const std::wstring& s, wchar_t delim); std::wstring ConvertUtf8ToWide(const std::string& str); -DWORD WINAPI Updater(LPVOID) +//DWORD WINAPI Updater(LPVOID) +UINT WINAPI Updater(LPVOID) { LOG_TO_FILE(L"Entering the %s() function", TEXT(__FUNCTION__)); @@ -115,7 +116,8 @@ DWORD WINAPI Updater(LPVOID) LOG_TO_FILE(L"[UPDT] Exit from the %s() function", TEXT(__FUNCTION__)); - return 0; + //return 0; + _endthreadex(0); } bool GetLatestRelease(const std::wstring& urn) diff --git a/wCenterWindow/updater.h b/wCenterWindow/updater.h index cf769e8..3144bec 100644 --- a/wCenterWindow/updater.h +++ b/wCenterWindow/updater.h @@ -2,4 +2,5 @@ // updater.h // #pragma once -DWORD WINAPI Updater(LPVOID); +//DWORD WINAPI Updater(LPVOID); +UINT WINAPI Updater(void*); diff --git a/wCenterWindow/wCenterWindow.cpp b/wCenterWindow/wCenterWindow.cpp index 63b9900..a3e1d46 100644 --- a/wCenterWindow/wCenterWindow.cpp +++ b/wCenterWindow/wCenterWindow.cpp @@ -25,6 +25,7 @@ WCHAR szClass[MAX_LOADSTRING]; // Window's class WCHAR szWinTitle[256]; WCHAR szWinClass[256]; HANDLE hHeap = NULL, hUpdater = NULL; +UINT dwUpdaterID = 0; HHOOK hMouseHook = NULL, hKbdHook = NULL; // Hook's handles HICON hIcon = NULL; HMENU hMenu = NULL, hPopup = NULL; @@ -278,7 +279,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LOG_TO_FILE(L"%s(%d): Checking for updates is enabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False"); - hUpdater = CreateThread(NULL, 0, &Updater, nullptr, 0, nullptr); + //hUpdater = CreateThread(NULL, 0, &Updater, nullptr, 0, nullptr); + hUpdater = (HANDLE)_beginthreadex(NULL, 0, &Updater, NULL, 0, &dwUpdaterID); if (NULL == hUpdater) { DWORD dwLastError = GetLastError(); diff --git a/wCenterWindow/wCenterWindow.h b/wCenterWindow/wCenterWindow.h index 5ec4d48..2fcfae8 100644 --- a/wCenterWindow/wCenterWindow.h +++ b/wCenterWindow/wCenterWindow.h @@ -15,6 +15,7 @@ #include #include #include +#include // VerionInfo header file #include "VersionInfo.h"