Jump to content

DLL call


Recommended Posts

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

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

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 link

http://www.autoitscript.com/forum/index.php?showtopic=111019

You seems to be advanced user probably you know that..anyways thanks for your inputs :blink:

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...