vb6中调用外部动态库三个函数申明如下,调返回值均正确:
Public Declare Function PasswordDetect Lib "playch32.dll" (ByVal strPassWord As String, ByVal strPath As String) As IntegerPublic Declare Function TV_StartPlayCh Lib "playch32.dll" (ByVal chn As Integer, ByVal ByValstrSentence As String) As IntegerPublic Declare Function TV_PlayChRest Lib "playch32.dll" (ByVal chn As Integer) As Integer用微软工具升级到C#和手工修改后调用程序代码基本没变,但调用以上三个函数时,调返值都异常,实在很是奇怪和郁闷啊,C#中三个函数动态库调用申明如下:
[DllImport("playch32.dll", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern short PasswordDetect(string strPassWord, string strPath);[DllImport("playch32.dll", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern short TV_StartPlayCh(short chn, string strSentence);[DllImport("playch32.dll", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern short TV_PlayChRest(short chn);请各位帮忙,十分感谢!