evlo Posted July 26, 2011 Posted July 26, 2011 (edited) Can you help me how to use AutoitX (ocx/activeX library) in .net c# application without registering it? I would like to create application with it without need to use administrator rights for installation. I found some links on MS like this http://msdn.microsoft.com/en-us/library/ms973913.aspx about creating manifest files for dlls. I tried it and did not succeed. So maybe it is possible and i created it wrongly. Unfortunately i lost the xmls so i can't post it here. Also i tried setting isolated and enable interop types in reference properties without success. So if you managed to get autoitX working in C# without need for registering it please help me how to do it. I think it should be possible to use as DLL and not OCX but i don't know how exacly to do it in c#. Thank you currently i use it like AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3(); autoit.AutoItSetOption("WinTitleMatchMode", 2); etc. So if i would go for direct dll calls how to do it then? If i try to add DLL directly i get - "module was expected to contain an assembly manifest" "this file may not be a managed assembly". That manifest file is exactly file that i would like to have, filename should be "AutoItX3.manifest" or maybe AutoItX3.dll.manifest. my manifest attempts - both don't work <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Copyright (c) Microsoft Corporation. All rights reserved. --> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.1" processorArchitecture="x86" name="AutoIt.AutoItX3" type="win32" /> <file name="AutoItX3.dll"> </file> </assembly> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Copyright (c) Microsoft Corporation. All rights reserved. --> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="3.3.6.1" processorArchitecture="x86" name="AutoIt.AutoItX3" type="win32" /> <file name="AutoItX3.dll"> </file> </assembly> and naming it AutoIt.AutoItX3.manifest I also tried <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Copyright (c) Microsoft Corporation. All rights reserved. --> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="3.3.6.1" processorArchitecture="x86" name="AutoItX3" type="win32" /> <file name="AutoItX3.dll"> </file> </assembly> and<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Copyright (c) Microsoft Corporation. All rights reserved. --> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="3.3.6.1" processorArchitecture="x86" name="AutoItX3" type="win32" /> <file name="AutoItX3.dll"> </file> </assembly> and naming it AutoIt.manifest Edited July 26, 2011 by evlo
Richard Robertson Posted July 27, 2011 Posted July 27, 2011 Why not just use platform invoke and call the exported dll functions instead? Then there's no need to register it.
evlo Posted July 28, 2011 Author Posted July 28, 2011 Then i would need to define each method call separately like [DllImport("msvcrt.dll")] internal static extern int _flushall(); Right?
Marlon Posted December 20, 2013 Posted December 20, 2013 Hi. I'm trying to do this. Everything ist's ok, no error, but it doesn't work, i'm trying to do a simple example with notepad Any idea?
Administrators Jon Posted December 20, 2013 Administrators Posted December 20, 2013 Download the beta and just include AutoItX.Assembly.dll into your c# program which gives you a nice easy interface without having to mess with DllImport.
Richard Robertson Posted December 21, 2013 Posted December 21, 2013 Wow, thread necro of two and a half years.
mbv401920150 Posted December 4, 2015 Posted December 4, 2015 (edited) -- DELETE POST -- Edited December 4, 2015 by mbv401920150
mbv401920150 Posted December 4, 2015 Posted December 4, 2015 Download the beta and just include AutoItX.Assembly.dll into your c# program which gives you a nice easy interface without having to mess with DllImport.Great!; I do it and works on C# Framework 3.5 and above.The only thing; you should include the AutoItX.Assembly.dll as reference in your program; also, make a raw copy of the AutoItX3.dll in you debug folder (Where the main executable is located). After that; works like a charm!Example:private static void downloadData(string filePath) { try { fw.fileDelete(filePath); System.Threading.Thread.Sleep(5000); string strWinSave = "Save As"; do { System.Threading.Thread.Sleep(500); AutoIt.AutoItX.ControlSetText(strWinSave, "", "Edit1", ""); System.Threading.Thread.Sleep(500); AutoIt.AutoItX.ControlSend(strWinSave, "", "Edit1", filePath); System.Threading.Thread.Sleep(500); AutoIt.AutoItX.ControlSend(strWinSave, "", "Edit1", "{ENTER}"); System.Threading.Thread.Sleep(500); } while (AutoIt.AutoItX.WinExists(strWinSave, "") != 0); } catch (Exception ex) { throw new Exception("Error downloading information", ex); } }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now