packages feed

Win32 2.8.3.0 → 2.8.4.0

raw patch · 3 files changed

+47/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Graphics.Win32.Window: c_GetWindowText :: HWND -> LPTSTR -> Int -> IO Int
+ Graphics.Win32.Window: c_GetWindowTextLength :: HWND -> IO Int
+ Graphics.Win32.Window: getWindowText :: HWND -> Int -> IO String
+ Graphics.Win32.Window: getWindowTextLength :: HWND -> IO Int

Files

Graphics/Win32/Window.hsc view
@@ -22,6 +22,7 @@ import Foreign.ForeignPtr (withForeignPtr) import Foreign.Marshal.Utils (maybeWith) import Foreign.Marshal.Alloc (allocaBytes)+import Foreign.Marshal.Array (allocaArray) import Foreign.Ptr (FunPtr, Ptr, castFunPtrToPtr, castPtr, nullPtr) import Foreign.Storable (pokeByteOff) import Foreign.C.Types (CIntPtr(..))@@ -34,8 +35,8 @@ import System.IO.Unsafe (unsafePerformIO) import System.Win32.Types (ATOM, maybePtr, newTString, ptrToMaybe, numToMaybe) import System.Win32.Types (Addr, BOOL, DWORD, INT, LONG, LRESULT, UINT, WPARAM)-import System.Win32.Types (HINSTANCE, LPARAM, LPCTSTR, LPVOID, withTString)-import System.Win32.Types (failIf, failIf_, failIfFalse_, failIfNull, maybeNum)+import System.Win32.Types (HINSTANCE, LPARAM, LPCTSTR, LPTSTR, LPVOID, withTString, peekTString)+import System.Win32.Types (failIf, failIf_, failIfFalse_, failIfNull, maybeNum, failUnlessSuccess, getLastError, errorWin)  ##include "windows_cconv.h" @@ -320,6 +321,41 @@   failIfFalse_ "SetWindowText" $ c_SetWindowText wnd c_text foreign import WINDOWS_CCONV "windows.h SetWindowTextW"   c_SetWindowText :: HWND -> LPCTSTR -> IO Bool++----------------------------------------------------------------+-- Getting window text/label+----------------------------------------------------------------+-- For getting the title bar text. +-- If the window has no title bar or text, if the title bar is empty,+-- or if the window or control handle is invalid, the return value is zero.+-- If invalid handle throws exception.+-- If size <= 0 throws exception.++getWindowText :: HWND -> Int -> IO String+getWindowText wnd size +  | size <= 0 = errorWin "GetWindowTextW"+  | otherwise  = do+      allocaArray size $ \ p_buf -> do+      _ <- c_GetWindowText wnd p_buf size+      failUnlessSuccess "GetWindowTextW" getLastError+      peekTString p_buf+foreign import WINDOWS_CCONV "windows.h GetWindowTextW"+  c_GetWindowText :: HWND -> LPTSTR -> Int -> IO Int++----------------------------------------------------------------+-- Getting window text length+----------------------------------------------------------------+-- For getting the title bar text length. +-- If the window has no text, the return value is zero.+-- If invalid handle throws exception.+  +getWindowTextLength :: HWND -> IO Int+getWindowTextLength wnd = do+  size' <- c_GetWindowTextLength wnd+  failUnlessSuccess "GetWindowTextLengthW" getLastError+  return size'+foreign import WINDOWS_CCONV "windows.h GetWindowTextLengthW"+  c_GetWindowTextLength :: HWND -> IO Int  ---------------------------------------------------------------- -- Paint struct
Win32.cabal view
@@ -1,5 +1,5 @@ name:		Win32-version:	2.8.3.0+version:	2.8.4.0 license:	BSD3 license-file:	LICENSE author:		Alastair Reid, shelarcy, Tamar Christina@@ -11,7 +11,7 @@ synopsis:	A binding to Windows Win32 API. description:	This library contains direct bindings to the Windows Win32 APIs for Haskell. build-type:     Simple-cabal-version:  >=1.10+cabal-version:  >= 2.0 extra-source-files:         include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h         include/Win32Aux.h include/win32debug.h include/alignment.h@@ -29,6 +29,8 @@         buildable: False      build-depends:	base >= 4.5 && < 5, bytestring, filepath+    -- Black list hsc2hs 0.68.6 which is horribly broken.+    build-tool-depends: hsc2hs:hsc2hs > 0 && < 0.68.6 || > 0.68.6     ghc-options:    -Wall -fno-warn-name-shadowing     cc-options:     -fno-strict-aliasing     exposed-modules:
changelog.md view
@@ -1,5 +1,10 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## 2.8.4.0 *Oct 2019*++* Added function `getWindowText`+* Added function `getWindowTextLength`+ ## 2.8.3.0 *Feb 2019*  * Add `Module32FirstW` and `Module32NextW` (See #121)