我试图调用WindowsCE5API调用,即"FindFirstChangeNotification“在VS2008智能设备项目中使用:
Private Declare Function FindFirstChangeNotification Lib "coredll.dll" _
(ByVal lpPathName As String, ByVal bWatchSubtree As Long, _
ByVal dwNotifyFilter As Long) As Long
Dim strFolderPath As String = "\My Documents\My App Files\"
Dim ptrHandle as IntPtr = FindFirstChangeNotification(strFolderPath, 0, 1)尝试此方法会导致"System.NotSupportedException“,我认为这是字符串类型中的不兼容。尽管尝试了不同的封送行为,但几天后我仍然停滞不前。
发布于 2015-12-04 01:15:40
Windows中的字符串类型是Unicode,因此声明为String应该是正确的。
Coredll实际上将函数导出为FindFirstChangeNotificationW (请注意尾随'W'),所以这很可能是您获得异常的原因。
'W‘表示函数的宽(如宽字符或Unicode )的实现.通常,您可以在Visual命令提示符中使用dumpbin工具来标识函数导出的名称,在本例中,我使用dumpbin /exports coredll.dll进行检查。
而且,据我所知,在VB.Net Long中是64位类型,FindFirstChangeNotification需要32位参数。
所以试试这个:
Private Declare Function FindFirstChangeNotificationW Lib "coredll.dll" _
(ByVal lpPathName As String, ByVal bWatchSubtree As Integer, _
ByVal dwNotifyFilter As Integer) As Integerhttps://stackoverflow.com/questions/34072392
复制相似问题