[英]Dll does not seem to be read, why?
I am creating a application form to view/change a tag from a software called InTouch. 我正在创建一个应用程序表单,以从称为InTouch的软件查看/更改标签。
I added the dll as a reference and I would like to use the Read(string tagName
) fct in the IOM.InTouchDataAccess. 我添加了dll作为参考,并且我想在IOM.InTouchDataAccess中使用
Read(string tagName
)fct。 VS does not see the fct Read when I write InTouchWrapper TagType = new read()
. 当我编写
InTouchWrapper TagType = new read()
时,VS看不到fct Read。 It only sees InTouchWrapper as I wrote in the code which gives me the error IOM.InTouchDataAccess.InTouchWrapper' does not contain a constructor that takes 0 arguments
它只会看到我在代码中编写的InTouchWrapper,该错误给了我
IOM.InTouchDataAccess.InTouchWrapper' does not contain a constructor that takes 0 arguments
I don't understand why is this happening. 我不明白为什么会这样。 I am running the InTouch software while coding, maybe there is an access conflict with the software.
我在编码时正在运行InTouch软件,可能与该软件存在访问冲突。
MyCode 我的密码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IOM.InTouchDataAccess;
namespace TagBrowser
{
public partial class TagBrowser : Form
{
public TagBrowser()
{
InitializeComponent();
}
private void TagBrowser_Load(object sender, EventArgs e)
{
}
private void TagBox_TextChanged(object sender, EventArgs e)
{
}
private void TypeBox_SelectedIndexChanged(object sender, EventArgs e)
{
InTouchWrapper TagType = new InTouchWrapper();
}
The dll dll文件
using System;
using System.Collections.Generic;
using System.Text;
using NDde.Client;
namespace IOM.InTouchDataAccess
{
public class InTouchDdeWrapper : IDisposable
{
private int DDE_TIMEOUT = 60000;
private DdeClient _ddeClient;
public InTouchDdeWrapper()
{
_ddeClient = new DdeClient("View", "Tagname");
}
~InTouchDdeWrapper()
{
Dispose();
}
public void Initialize()
{
_ddeClient.Connect();
}
public string Read(string tagName)
{
return _ddeClient.Request(tagName, DDE_TIMEOUT).Replace("\0", "");
}
I'm putting this here in case somebody else would get the same problem: 我将其放在此处,以防其他人遇到相同的问题:
Are you sure it's the correct dll you referenced?
您确定这是您引用的正确的dll吗? Try to open the exact referenced dll in a decompiler ( JustDecompile free , Reflector or dotPeek free ) and see if it's the code you expect.
尝试在反编译器( JustDecompile free , Reflector或dotPeek free )中打开确切引用的dll,然后查看它是否为您所期望的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.