Доброго времени суток народ. Собственно хочу в AccessXP в модуле использовать функции из dll. Делаю объявление этой функции Declare Function OpenComm Lib "c:\winnt\system\cipher.dll" (ByVal nCommPort As Integer) As Boolean При использовании этой функции в коде получаю ошибку, что нет такой функции в dll. То что она там есть это 100%.
Использую эту функцию таким макаром
Dim Port As Boolean
Port = OpenComm(2)
У меня есть файл заголовков, который шел с dll. Может быть он прояснит ситуацию.
// The following ifdef block is the standard way of creating macros which make exporting // from a DLL simpler. All files within this DLL are compiled with the CIPHER_EXPORTS // symbol defined on the command line. this symbol should not be defined on any project // that uses this DLL. This way any other project whose source files include this file see // CIPHER_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. #ifdef CIPHER_EXPORTS #define CIPHER_API __declspec(dllexport) #else #define CIPHER_API __declspec(dllimport) #endif
// This class is exported from the Cipher.dll class CIPHER_API CCipher { public: //methods BOOL OpenComm(int nCommPort, BOOL bIsIrDA = FALSE); BOOL CheckComm(); void CloseComm(); int GetLastError(); BOOL GetErrorDescription(int nError, LPSTR szData); BOOL Ping(); BOOL GetSerialNumber(LPSTR szData); BOOL GetTime(LPSTR szData); BOOL UpdateTime(); long GetFreeMemory(); BOOL GetCurrentState(LPSTR szData); long GetDataCount(int nDoc); long GetRecordsCount(int nBase); BOOL ClearDoc(int nDoc); BOOL ClearDatabase(int nBase); int ReadData(int nDoc, LPSTR szData); int ReadRecord(int nBase, LPSTR szData); BOOL PutRecord(int nBase, LPCSTR szData); BOOL Finish(); //start of implementation block CCipher(); ~CCipher(); //variables HANDLE m_hComm; DCB m_dcb; OVERLAPPED m_ov; COMSTAT m_stat; int m_nLastError; int m_nCommPort; BOOL m_bIsIrDA; protected: //methods BOOL InitComm(); BOOL OpenIrDA(); BOOL TestIrDA(DWORD spec); BOOL SendCommand(LPCSTR szCommand, LPSTR szData); //variables char szIrDA[16]; };
int __declspec(dllexport) __stdcall ExtPing(int nCommPort, BOOL bIsIrDA = FALSE); long __declspec(dllexport) __stdcall ExtGetFreeMemory(int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtGetSerialNumber(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtGetTime(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtUpdateTime(int nCommPort, BOOL bIsIrDA = FALSE);
int __declspec(dllexport) __stdcall ExtGetCurrentState(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); long __declspec(dllexport) __stdcall ExtGetDataCount(int nDoc, int nCommPort, BOOL bIsIrDA = FALSE); long __declspec(dllexport) __stdcall ExtGetRecordsCount(int nBase, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtClearDoc(int nDoc, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtClearDatabase(int nBase, int nCommPort, BOOL bIsIrDA = FALSE); int __declspec(dllexport) __stdcall ExtReadData(int nDoc, LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); int __declspec(dllexport) __stdcall ExtReadRecord(int nBase, LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtPutRecord(int nBase, LPCSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); BOOL __declspec(dllexport) __stdcall ExtFinish(int nCommPort, BOOL bIsIrDA = FALSE);
/* extern "C" __declspec(dllexport) __stdcall WINAPI int ExtPing(int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI long ExtGetFreeMemory(int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtGetSerialNumber(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtGetTime(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtUpdateTime(int nCommPort, BOOL bIsIrDA = FALSE);
extern "C" __declspec(dllexport) __stdcall WINAPI int ExtGetCurrentState(LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI long ExtGetDataCount(int nDoc, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI long ExtGetRecordsCount(int nBase, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtClearDoc(int nDoc, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtClearDatabase(int nBase, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI int ExtReadData(int nDoc, LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI int ExtReadRecord(int nBase, LPSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtPutRecord(int nBase, LPCSTR szData, int nCommPort, BOOL bIsIrDA = FALSE); extern "C" __declspec(dllexport) __stdcall WINAPI BOOL ExtFinish(int nCommPort, BOOL bIsIrDA = FALSE); */ Ну вот, собственно жду помощи от знающих людей.
Ответить
|