在C#调用DLL(c++编写的)时,经常会遇上参数为TCHAR,只需要在string前加上[MarshalAs(UnmanagedType.LPWStr)]即可。
例如:
public delegate int LMC1_INITIAL([MarshalAs(UnmanagedType.LPWStr)] string strEzCadPath,//ezcad的工作目录 int bTestMode,//是否是测试模式 IntPtr hOwenWnd);//父窗口
在C#调用DLL(c++编写的)时,经常会遇上参数为TCHAR,只需要在string前加上[MarshalAs(UnmanagedType.LPWStr)]即可。
例如:
public delegate int LMC1_INITIAL([MarshalAs(UnmanagedType.LPWStr)] string strEzCadPath,//ezcad的工作目录 int bTestMode,//是否是测试模式 IntPtr hOwenWnd);//父窗口