From aba9b9b6f354e870df659c39c597748f4a3c586b Mon Sep 17 00:00:00 2001 From: CatChow0 Date: Fri, 5 Apr 2024 17:01:10 +0200 Subject: [PATCH] Patch Update - WM_DROPFILES Bug fix FIX : Le Bug du message WM_DROPFILES lors d'un message WM_SIZE --- enginecustom/Systemclass.cpp | 39 ++++++++++++++++++++++----------- enginecustom/applicationclass.h | 1 + enginecustom/systemclass.h | 1 + 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/enginecustom/Systemclass.cpp b/enginecustom/Systemclass.cpp index 36c9b01..0471393 100644 --- a/enginecustom/Systemclass.cpp +++ b/enginecustom/Systemclass.cpp @@ -206,23 +206,36 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam m_initialWindowHeight = newHeight; } } + case WM_ENTERSIZEMOVE: + { + m_isResizing = true; + break; + } + case WM_EXITSIZEMOVE: + { + m_isResizing = false; + break; + } case WM_DROPFILES: { - HDROP hDrop = reinterpret_cast(wparam); - UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); + if (!m_isResizing) + { + HDROP hDrop = reinterpret_cast(wparam); + UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); - if (numFiles > 0) { - // Handle dropped files here - for (UINT i = 0; i < numFiles; ++i) { - // Get the file name - WCHAR filePath[MAX_PATH]; - DragQueryFile(hDrop, i, filePath, MAX_PATH); - std::wcout << L"File dropped: " << filePath << std::endl; - m_Application->AddKobject(filePath); - } - } + if (numFiles > 0 && m_Application != nullptr) { + // Handle dropped files here + for (UINT i = 0; i < numFiles; ++i) { + // Get the file name + WCHAR filePath[MAX_PATH]; + DragQueryFile(hDrop, i, filePath, MAX_PATH); + std::wcout << L"File dropped: " << filePath << std::endl; + m_Application->AddKobject(filePath); + } + } - DragFinish(hDrop); + DragFinish(hDrop); + } return 0; } // Any other messages send to the default message handler as our application won't make use of them. diff --git a/enginecustom/applicationclass.h b/enginecustom/applicationclass.h index 1b58a96..820f2d7 100644 --- a/enginecustom/applicationclass.h +++ b/enginecustom/applicationclass.h @@ -156,6 +156,7 @@ private : FpsClass* m_Fps; TextClass* m_FpsString; int m_previousFps; + }; #endif \ No newline at end of file diff --git a/enginecustom/systemclass.h b/enginecustom/systemclass.h index 0428e34..ec7e589 100644 --- a/enginecustom/systemclass.h +++ b/enginecustom/systemclass.h @@ -37,6 +37,7 @@ private: int m_initialWindowWidth; int m_initialWindowHeight; bool m_isDirect3DInitialized; + bool m_isResizing = false; };