class Bot(Control): def Start(): CreateControl() #AccSession setup to go here Application.Run()
PInvoke
Next pinvoke is required to creat the AccSession instance. This is in some of the SDK samples, but it wasn't obvious looking at the java and c++ sample bots. It only calls acccore.dll, but other dll's in the accsdk/dist/release/ are needed I'm just using the full path, but should copy the required dll's to my project file.
[DllImport("C:\\accsdk\\dist\\release\\acccore.dll", EntryPoint:"#111", PreserveSig:false, SetLastError:true)] private static def AccCreateSession( [MarshalAs(UnmanagedType.LPStruct)] riid as Guid, [MarshalAs(UnmanagedType.IDispatch)] ref session as object) as IntPtr: pass
Calling the method is pretty strait forward, just pass in an object and then cast the object to a AccSession.
... CreateControl() o as object AccCreateSession(typeof(IAccSession).GUID, o) _session = o as AccSession ...
Login
The next step was to wire up the events I wanted to get catch, I choose to wire up all the events for logging. You need to provide your API key and then login.
... handler = AccSessionEventHandler(BoxesImResponder()) handler.WireSession(_session) _session.ClientInfo.Property[AccClientInfoProp.AccClientInfoProp_Description] = _key _session.Identity = _username _session.SignOn(_password) Application.Run() ...
That's finally all I needed to get the bot running. I fought with setting preferences for a long while like the java example shows, but I ended up following the c++ example to filter which messages get accepted. More to follow in later posts. In addition, I plan on posting the full source code when the application is working.
I'm Dusty Candland a software developer in Colorado.
Email