maxi Posted July 21, 2010 Share Posted July 21, 2010 I called a dll function from Autoit. $xmlPath = "E:\autoit\SIM_Smoke\XYZ.pl.xml" DllCall("XMLReader.dll","none","GetProductName","str",$xmlPath) MsgBox(0,"",@error) Below is the DLL class code: using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; namespace XMLReader { public class ProductListingReader { //default Constructor public ProductListingReader() { } public void GetProductName(string xmlPath) { // List<string> productList = new List<string>(); // create a writer and open the file TextWriter tw = new StreamWriter(@"E:\ProductList.txt"); try { XmlDocument xDoc = new XmlDocument(); xDoc.Load(xmlPath); XmlElement root = xDoc.DocumentElement; XmlNodeList lst = root.GetElementsByTagName("product"); foreach (System.Xml.XmlNode n in lst) { tw.WriteLine(n.Attributes["definitionName"].Value); } } catch (Exception e) { } // close the stream tw.Close(); //File.Delete("ProductList.txt"); } } } While running script i am getting @error value 3, which means function not found in the DLL file. Any help?? Link to comment Share on other sites More sharing options...
James Posted July 21, 2010 Share Posted July 21, 2010 (edited) XMLReader.dll is probably located in the script directory? DllCall(@ScriptDir & "\XMLReader.dll","none","GetProductName","str",$xmlPath) James Edited July 21, 2010 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
frank10 Posted July 21, 2010 Share Posted July 21, 2010 Maybe try to put the full path of your dll when you call it in DllCall. Link to comment Share on other sites More sharing options...
maxi Posted July 21, 2010 Author Share Posted July 21, 2010 Maybe try to put the full path of your dll when you call it in DllCall.If Autoit not able to read dll file. It should set @error to 1. Link to comment Share on other sites More sharing options...
frank10 Posted July 21, 2010 Share Posted July 21, 2010 Have you tried with Dll Export Viewer? Just to be sure the func is visible and with the same name in the compiled dll. Link to comment Share on other sites More sharing options...
maxi Posted July 21, 2010 Author Share Posted July 21, 2010 I have tried to access function through c# console application, It is working. static void Main(string[] args) { XMLReader.ProductListingReader p = new XMLReader.ProductListingReader(); p.GetProductName(@"E:\autoit\SIM_Smoke\platform.pl.xml"); //Console.ReadLine(); } It has to be problem with auto it. Link to comment Share on other sites More sharing options...
trancexx Posted July 21, 2010 Share Posted July 21, 2010 DllCall is function made for advanced users. You are obviously not the one. Otherwise you wouldn't be asking what you ask. What do you know of c#? Listing few main characteristics will answer all your questions from here. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
maxi Posted July 21, 2010 Author Share Posted July 21, 2010 DllCall is function made for advanced users.You are obviously not the one. Otherwise you wouldn't be asking what you ask. What do you know of c#? Listing few main characteristics will answer all your questions from here.Later i found out that, you can't call C# dll directly through Autoit.For more details visits below mention linkhttp://www.autoitscript.com/forum/index.php?showtopic=111019You seems to be advanced user probably you know that..anyways thanks for your inputs Link to comment Share on other sites More sharing options...
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