急,请各位帮帮忙,DLL动态库函数引入问题?
我用到的是模拟语音卡自带的DJTTS.DLL,函数c原型是
int WINAPI DJTTS_StartPlayText( WORD wChnlNo,char *pText,int size,int IsFemale)
我在引入C#时写成
[DllImport("DJTTS.dll",CharSet=CharSet.Auto)]
public static extern short DJTTS_StartPlayText(short wChnlNo,[MarshalAs(UnmanagedType.LPTStr)]string pText,short size,short IsFemale);
调用:
string welcome = "1234";
Tc08aLib.DJTTS_StartPlayText(0,welcome,(short)welcome.Length,1);
或者写成
[DllImport("DJTTS.dll",CharSet=CharSet.Auto)]
public static extern short DJTTS_StartPlayText(short wChnlNo,[MarshalAs(UnmanagedType.LPTStr)]StringBuilder pText,short size,short IsFemale);
调用:
StringBuilder welcome = new StringBuilder("1234");
Tc08aLib.DJTTS_StartPlayText(0,welcome,(short)welcome.Length,1);
程序运行没有提示错误,但函数运行没有效果,放不出声音