Sign in to follow this  
Followers 0
maxi

DLL call

8 posts in this topic

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??

Share this post


Link to post
Share on other sites



Maybe try to put the full path of your dll when you call it in DllCall.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Have you tried with Dll Export Viewer?

Just to be sure the func is visible and with the same name in the compiled dll.

Share this post


Link to post
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.

Share this post


Link to post
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.


♡♡♡

.

eMyvnE

Share this post


Link to post
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:

Share this post


Link to post
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
Sign in to follow this  
Followers 0