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

Fix for win32 window confusion when running multiple juce apps.

This commit is contained in:
jules 2011-12-09 10:18:46 +00:00
parent 173e8c083f
commit 39f12d3cc6

View file

@ -73,16 +73,20 @@ class JuceWindowIdentifier
public:
static bool isJUCEWindow (HWND hwnd) noexcept
{
return GetWindowLong (hwnd, GWLP_USERDATA) == improbableWindowNumber;
return GetWindowLongPtr (hwnd, GWLP_USERDATA) == getImprobableWindowNumber();
}
static void setAsJUCEWindow (HWND hwnd, bool isJuceWindow) noexcept
{
SetWindowLongPtr (hwnd, GWLP_USERDATA, isJuceWindow ? improbableWindowNumber : 0);
SetWindowLongPtr (hwnd, GWLP_USERDATA, isJuceWindow ? getImprobableWindowNumber() : 0);
}
private:
enum { improbableWindowNumber = 0xf965aa01 };
static LONG_PTR getImprobableWindowNumber() noexcept
{
static LONG_PTR number = (LONG_PTR) Random::getSystemRandom().nextInt64();
return number;
}
};
//==============================================================================