I have Created an Event Handler for ADO.CONNECTION the functions do fire but the strings contain gibberish. The Long and Int return okay. I have looked up the interface and they should be returning Wstrings.. First ANybody know what a Wstring is ?? Im assuming that it is a Wide String, and how could that be converted in Auto-It to a human readable string. Thanks for any help you can give. I am connecting to a SQL Server 2008 server but you can connect to anything to test I believe
Below is the Function prototype givin by PowerBasic COM browser.
WillConnect <6> (ByRef InOut ConnectionString As WString, ByRef InOut UserID As WString, ByRef InOut Password As _
WString, ByRef InOut Options As Long, ByRef InOut adStatus As Long, Byval pConnection As Int__Connection)
#AutoIt3Wrapper_UseX64=n
#include
const $ConnInterface = "ConnectionEvents"
$conn = ObjCreate("ADODB.Connection")
$connEvent = ObjEvent($conn,"EVENTS_",$ConnInterface)
if @error then
Msgbox(0,"AutoIt COM Test", _
"ObjEvent: Can't use event interface '"& $ConnInterface &"'. Error code: " & hex(@error,8))
exit
endif
$conn.open ("Provider=SQLNCLI10;Server=ServerName;Database=Database;Uid=UID;pwd=pwd")
$conn.close()
Func EVENTS_ConnectComplete($ugh3,$ugh,$ugh1)
MsgBox(0,"ADO EVENT","Connected to DataBase")
EndFunc
Func EVENTS_Disconnect($ugh4,$ugh5)
MsgBox(0,"ADO EVENT","Disconnected from DataBase")
endFunc
Func EVENTS_WillConnect($ConnectionString,$val2,$val3,$val4,$val5,$val6)
ConsoleWrite($ConnectionString&@CRLF&$val2&@CRLF&$val3&@CRLF&$val4&@CRLF&$val5&@CRLF&$val6&@CRLF)
Msgbox(0,"Connection String",string($ConnectionString))
endFunc