2
我有VBA程序運行在Excel 64位調用某些DLL函數(C++)。問題是(顯然)它不能傳遞指向C++程序的指針。該程序適用於Excel 32位。操作系統是Windows 8。對於Windows 7,Excel的32位和64位版本都運行良好。VBA 64位Excel不傳遞指向DLL函數的指針(C++)
C++:
double test(long* v, long i)
{
if (v == NULL)
return -88;
else
return *((long*)v);
}
VBA:
Private Declare PtrSafe Function hamid_test Lib "...\CVode.dll" (ByVal v As LongPtr, ByVal i As Long) As Double
Dim x As LongLong
Dim z As Double
z = test(x, 1)
它返回-88
。
嘗試'Dim x As LongPtr' – kaybee99