2

I've noticed the Haskell Win32 api does not have a SetForegroundWindow function and I'm not skilled enough in haskell to add this feature myself. Would there be any way to replicate this using haskell or has any one made their own wrapper using ffi?

1 Answer 1

5

Here's a simple wrapper using the FFI:

{-# LANGUAGE ForeignFunctionInterface #-}

module SetForegroundWindow
( setForegroundWindow
) where

import Foreign
import Graphics.Win32

foreign import stdcall safe "windows.h SetForegroundWindow"
    c_setForegroundWindow :: HWND -> IO Bool

setForegroundWindow :: HWND -> IO Bool
setForegroundWindow = c_setForegroundWindow
Sign up to request clarification or add additional context in comments.

3 Comments

awesome! you should contribute this to the win32 github page,github.com/haskell/win32/blob/master/Graphics/Win32/Window.hsc
@pyCthon but why don't you contribute it by yourself?
@ДМИТРИЙМАЛИКОВ МАЛИКОВ I don't want so take credit for his work

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.