win32 SetForegroundWindow在haskell

pyC*_*hon 2 windows haskell

我注意到Haskell Win32 api没有SetForegroundWindow函数,我在haskell中不够熟练,我自己添加了这个功能.有没有办法使用haskell复制这个或者有没有人使用ffi制作自己的包装器?

Ter*_*iol 5

这是一个使用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
Run Code Online (Sandbox Code Playgroud)