Patch Update - WM_DROPFILES Bug fix

FIX : Le Bug du message WM_DROPFILES lors d'un message WM_SIZE
This commit is contained in:
CatChow0 2024-04-05 17:01:10 +02:00
parent df9d7c97c0
commit aba9b9b6f3
3 changed files with 28 additions and 13 deletions

View File

@ -206,23 +206,36 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam
m_initialWindowHeight = newHeight; m_initialWindowHeight = newHeight;
} }
} }
case WM_ENTERSIZEMOVE:
{
m_isResizing = true;
break;
}
case WM_EXITSIZEMOVE:
{
m_isResizing = false;
break;
}
case WM_DROPFILES: case WM_DROPFILES:
{ {
HDROP hDrop = reinterpret_cast<HDROP>(wparam); if (!m_isResizing)
UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); {
HDROP hDrop = reinterpret_cast<HDROP>(wparam);
UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
if (numFiles > 0) { if (numFiles > 0 && m_Application != nullptr) {
// Handle dropped files here // Handle dropped files here
for (UINT i = 0; i < numFiles; ++i) { for (UINT i = 0; i < numFiles; ++i) {
// Get the file name // Get the file name
WCHAR filePath[MAX_PATH]; WCHAR filePath[MAX_PATH];
DragQueryFile(hDrop, i, filePath, MAX_PATH); DragQueryFile(hDrop, i, filePath, MAX_PATH);
std::wcout << L"File dropped: " << filePath << std::endl; std::wcout << L"File dropped: " << filePath << std::endl;
m_Application->AddKobject(filePath); m_Application->AddKobject(filePath);
} }
} }
DragFinish(hDrop); DragFinish(hDrop);
}
return 0; return 0;
} }
// Any other messages send to the default message handler as our application won't make use of them. // Any other messages send to the default message handler as our application won't make use of them.

View File

@ -156,6 +156,7 @@ private :
FpsClass* m_Fps; FpsClass* m_Fps;
TextClass* m_FpsString; TextClass* m_FpsString;
int m_previousFps; int m_previousFps;
}; };
#endif #endif

View File

@ -37,6 +37,7 @@ private:
int m_initialWindowWidth; int m_initialWindowWidth;
int m_initialWindowHeight; int m_initialWindowHeight;
bool m_isDirect3DInitialized; bool m_isDirect3DInitialized;
bool m_isResizing = false;
}; };