[Haskell-cafe] Help on using System.Win32.Com.Automation

Sigbjorn Finne sigbjorn.finne at gmail.com
Mon Mar 23 02:11:40 EDT 2009


Hi Wilkes,

you may want to have a look at a simple example of how to
interop with Windows WMI using the COM package at --

  http://haskell.forkio.com/com-examples

Hope it is of some help to you.

--sigbjorn

On 3/19/2009 16:49, Wilkes Joiner wrote:
> I'm playing around with the com package, but I'm having a hard time
> understanding how to map a COM call to the appropriate methodN or
> functionN call.  Does anyone have any example code that uses the
> method1 or higher.  Any help or pointers would be appreciated.
>
> Here's the code I have so far:
>
>
> import System.Win32.Com
> import System.Win32.Com.Automation
>
>
> dsn = "Provider=vfpoledb.1;Data Source=C:\\SomeDirectory\\"
> main = coInitialize >>
>        openConnection >>= \con ->
>        closeConnection con
>
> openDSN :: String -> IDispatch a -> IO ()
> openDSN dsn con = method0 "Open" [inString dsn] con
>
> openConnection :: IO (IDispatch a)
> openConnection = createObject "ADODB.Connection" >>= \con -> openDSN
> dsn con >> return con
>
> closeConnection :: IDispatch a -> IO ()
> closeConnection =  method0 "Close" []
>
> {-
> Wraps ADO Connection.Execute
> http://msdn.microsoft.com/en-us/library/ms675023(VS.85).aspx
> Set recordset = connection.Execute (CommandText, RecordsAffected, Options)
>
> execute :: String -> IDispatch a -> IO a
> execute cmd con = method1 "Execute" [inString cmd] (inEmpty,resWord64) con
>
> -}
>
>
> Thank You,
> Wilkes
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>   



More information about the Haskell-Cafe mailing list