diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-18 00:17:44 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-18 00:17:44 +0300 |
commit | 427ae9ad54492954578cafbfcd2d815a084e0986 (patch) | |
tree | e81cdbf3b9f4d06c921f81a08264b214381d3c8a /src/Windows/Utils.hs | |
parent | refactoring (diff) | |
download | windows-env-427ae9ad54492954578cafbfcd2d815a084e0986.tar.gz windows-env-427ae9ad54492954578cafbfcd2d815a084e0986.zip |
put modules to 'Windows'
Diffstat (limited to 'src/Windows/Utils.hs')
-rw-r--r-- | src/Windows/Utils.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Windows/Utils.hs b/src/Windows/Utils.hs new file mode 100644 index 0000000..aad241f --- /dev/null +++ b/src/Windows/Utils.hs @@ -0,0 +1,28 @@ +{- + - Copyright 2016 Egor Tensin <Egor.Tensin@gmail.com> + - This file is licensed under the terms of the MIT License. + - See LICENSE.txt for details. +-} + +module Windows.Utils + ( notifyEnvironmentUpdate + ) where + +import qualified Graphics.Win32.GDI.Types as WinAPI +import qualified Graphics.Win32.Message as WinAPI +import qualified System.Win32.Types as WinAPI + +foreign import ccall "SendNotifyMessageW" + c_SendNotifyMessage :: WinAPI.HWND -> WinAPI.WindowMessage -> WinAPI.WPARAM -> WinAPI.LPARAM -> IO WinAPI.LRESULT + +notifyEnvironmentUpdate :: IO () +notifyEnvironmentUpdate = + WinAPI.withTString "Environment" $ \lparamPtr -> do + let wparam = 0 + let lparam = fromIntegral $ WinAPI.castPtrToUINTPtr lparamPtr + _ <- c_SendNotifyMessage allWindows messageCode wparam lparam + return () + where + messageCode = WinAPI.wM_WININICHANGE + hWND_BROADCAST = WinAPI.castUINTPtrToPtr 0xffff + allWindows = hWND_BROADCAST |