-4
A
回答
2
這裏的樣本:
[System.Runtime.InteropServices.DllImport("WBTRV32.dll", CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
static extern short BTRCALL(ushort operation,
[System.Runtime.InteropServices.MarshalAs (System.Runtime.InteropServices.UnmanagedType.LPArray, SizeConst = 128)] byte[] posBlk,
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct, SizeConst = 255)]
ref RecordBuffer databuffer,
ref int dataLength,
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPArray, SizeConst = 255)] char[] keyBffer,
ushort keyLength, ushort keyNum);
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
public struct RecordBuffer
{
public short docType;
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 2500)]
public char[] docDescPlural;
public short sorting;
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 2500)]
public char[] docDescSingle;
public short copyOtherThanSrc;
public double defaultNotebookNo;
}
private void PopulateAllRecords(string fileName)
{
byte[] positionBlock = new byte[128];
char[] fileNameArray = fileName.ToCharArray();
// Open file
RecordBuffer dataBuffer = new RecordBuffer();
int bufferLength = System.Runtime.InteropServices.Marshal.SizeOf(dataBuffer);
short status = (short)BTRCALL((ushort)OPCODE.BOPEN, positionBlock, ref dataBuffer, ref bufferLength, fileNameArray, 0, 0);
if (status == 0)
{
.....
}
}
相關問題
- 1. 在C++代碼中使用dll
- 2. 使用C#的Dll與C++代碼
- 3. 你可以在UWP中的C#代碼中使用C++ DLL嗎?
- 4. 調用C#的.dll ++代碼
- 5. 在C#代碼中調用C++ dll代碼
- 6. 在C#代碼中使用C++ DLL函數的問題
- 7. C源代碼DLL
- 8. 從C#調用C dll代碼?
- 9. visual c#2010不能在dll中使用複製代碼
- 10. 如何使用C#代碼在Visual Studio中創建本機DLL?
- 11. 使用C++代碼調用FORTRAN DLL中的函數
- 12. 在C#中使用C++ dll#
- 13. 從C#代碼調用.net DLL的
- 14. 在從C#代碼調用dll函數時出錯代碼
- 15. 使用從C++代碼中定義的DLL函數
- 16. 如何使用C中第三個DLL的代碼?
- 17. 使用.dll文件的方法在C#代碼
- 18. 從使用.NET代碼的C++/CLI DLL導出C函數
- 19. 來自C++源代碼的C-DLL
- 20. 在我的C#代碼中調用COM DLL API的步驟
- 21. 在C DLL,在C#中使用的PInvoke
- 22. 如何在c代碼中調用postgis-1.5.dll的函數
- 23. C#代碼中調用C函數從dll後的ArithmeticException
- 24. 如何從C代碼調用C#DLL中的方法?
- 25. 從C#調用delphi DLL函數代碼
- 26. 從C#代碼調用delphi DLL方法
- 27. 本機代碼在C++/CLI DLL
- 28. DLL在C++中使用另一個DLL
- 29. 啓用在VB.net中調用C DLL代碼
- 30. 遞歸調用buff/unbuff? C#Unity3D
這不是一個樣本提供服務,這是一個代碼,幫助服務。我們幫助現有的代碼,而不是按需創建教程。 –
查看Btrieve SDK。如果您使用6.15,您將被限制爲32位C#。 Pervasive的網站上有一個樣本,但是它適用於更高版本的Btrieve。 – mirtheil