1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

DragAndDrop: Fix drag and drop in windows optimised builds

In very optimised builds, SHCore.dll may not be automatically loaded
into the address space of the calling executable. In these cases, the
call to `GetModuleHandle` will fail. Adding the call to LoadLibrary
ensures that the dll is loaded into the program's address space, which
will allow the call to GetModuleHandle to succeed.
This commit is contained in:
reuk 2021-01-06 11:28:38 +00:00
parent e988c4c671
commit 88285acae1
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -362,7 +362,9 @@ static void setDPIAwareness()
if (! JUCEApplicationBase::isStandaloneApp())
return;
HMODULE shcoreModule = GetModuleHandleA ("SHCore.dll");
const auto shcore = "SHCore.dll";
LoadLibraryA (shcore);
const auto shcoreModule = GetModuleHandleA (shcore);
if (shcoreModule != nullptr)
{