use GuiEdit.au3 autoit function in c#

雨燕双飞 提交于 2020-03-27 08:48:21

问题


I'm working on a screen reader and I need to get the word under the caret. After googling and also searching similar questions here, I found the only ways are either using OCR, or using autoit. I found how to get the word using autoit, but it needs the function GuiEdit.au3. In autoit I can do this by just using "include ", but how about c#. I added AutoItX3Lib to the references, but how about including the function?

In short: how to use pre-written autoit functions in c# after adding the AutoItX3Lib.dll?

Thanks for any help and let me know if anything is unclear. :)


回答1:


You can try this .NET wrapper: http://www.autoitscript.com/forum/topic/39017-net-wrapper-project/

Or you can open the "Project->add reference" dialog in Visual Studio, and add a COM reference (click the COM tab) to AutoITX. You should then be able to use the DLL functions through P/Invoke or writing a managed wrapper. If you need guidance on using P/Invoke or writing a managed wrapper... It's a bit tough, but if you're motivated you can do it (I have), but it requires you to learn a bit of C++.

http://ondotnet.com/pub/a/dotnet/2004/03/29/mcpp_part3.html http://msdn.microsoft.com/en-us/library/aa719104(v=vs.71).aspx




回答2:


Just for those who are facing the same problem, I have to mention that I stopped using autoit and tried to write the methods in c# myself (using SendMessage and related methods). It's so simple and now it's working fine!



来源:https://stackoverflow.com/questions/7010501/use-guiedit-au3-autoit-function-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!