[commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add function to find window by name only (#69) (d1c4a93)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:28:06 UTC 2017


Repository : ssh://git@git.haskell.org/Win32

On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2
Link       : http://git.haskell.org/packages/Win32.git/commitdiff/d1c4a935673b9f36ab46cff05f1cc67d2f9c1009

>---------------------------------------------------------------

commit d1c4a935673b9f36ab46cff05f1cc67d2f9c1009
Author: Jason Shipman <jship at users.noreply.github.com>
Date:   Thu Dec 22 04:27:01 2016 -0500

    Add function to find window by name only (#69)


>---------------------------------------------------------------

d1c4a935673b9f36ab46cff05f1cc67d2f9c1009
 Graphics/Win32/Window.hsc | 5 +++++
 changelog.md              | 1 +
 2 files changed, 6 insertions(+)

diff --git a/Graphics/Win32/Window.hsc b/Graphics/Win32/Window.hsc
index 0138b13..90fb2d2 100644
--- a/Graphics/Win32/Window.hsc
+++ b/Graphics/Win32/Window.hsc
@@ -475,6 +475,11 @@ findWindow cname wname =
   withTString cname $ \ c_cname ->
   withTString wname $ \ c_wname ->
   liftM ptrToMaybe $ c_FindWindow c_cname c_wname
+
+findWindowByName :: String -> IO (Maybe HWND)
+findWindowByName wname = withTString wname $ \ c_wname ->
+  liftM ptrToMaybe $ c_FindWindow nullPtr c_wname
+
 foreign import WINDOWS_CCONV unsafe "windows.h FindWindowW"
   c_FindWindow :: LPCTSTR -> LPCTSTR -> IO HWND
 
diff --git a/changelog.md b/changelog.md
index 2e5fc37..61d899e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,6 +4,7 @@
 
 * `failWith` (and the API calls that use it) now throw `IOError`s with proper
   `IOErrorType`s.
+* Add function `findWindowByName`
 * Fix a bug in the implementation of `poke` for `TIME_ZONE_INFORMATION` which
   would cause it to be marshalled incorrectly.
 * Add `System.Win32.MinTTY` module for detecting the presence of MinTTY.



More information about the ghc-commits mailing list