[Haskell-cafe] Help on using System.Win32.Com.Automation
Wilkes Joiner
wilkesjoiner at gmail.com
Thu Mar 19 19:49:03 EDT 2009
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
More information about the Haskell-Cafe
mailing list