{
try
{
string word = textBox1.Text;
if (word.Length == 0) MessageBox.Show("输入的英文不能是空!");
else
{
IntPtr s = Marshal.StringToHGlobalAnsi("");
CPPDLL.deleteword(ref s, word);
string cstr = Marshal.PtrToStringAnsi(s);//得到值
textBox2.Text = cstr;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button3_Click(object sender, EventArgs e)//查找
try
{
string word = textBox1.Text;
if (textBox1.Text.Length == 0) MessageBox.Show("输入内容不能为空!");
else
{
IntPtr s = Marshal.StringToHGlobalAnsi("");
CPPDLL.txtReader(ref s, word);
string cstr = Marshal.PtrToStringAnsi(s);//得到值
textBox2.Text = cstr;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}