LIBOPTO int OptoPCI_OpenDriver ( char szShortPath[260] );
LIBOPTO int OptoPCI_CloseDriver ( );
LIBOPTO int OptoPCI_DAQ_Info ( VXD_VERSION_INFO *VersionInfo );
LIBOPTO int OptoPCI_DAQ_Parameter ( WORD id, WORD ChanNo, WORD ChanPos[4], UINT SensorType[4], UINT SensorRange[4], double Autozero[4], WORD BlockSize, BOOL encoderOnFIFO, BOOL useGate, WORD sensor);
LIBOPTO int OptoPCI_DAQ_EncoderParam ( WORD id, WORD clock, WORD countingMode, BOOL changeDir, BOOL invert, WORD startValue, WORD refSetting, WORD refValue);
LIBOPTO int OptoPCI_DAQ_EncoderExchange ( WORD id, WORD fkt, WORD *value);
LIBOPTO int OptoPCI_DAQ_SetAverage ( WORD id, BOOL enable[4], BOOL persistant[4], WORD average[4]);
LIBOPTO int OptoPCI_DAQ_Start ( WORD id );
LIBOPTO int OptoPCI_DAQ_Sync();
LIBOPTO int OptoPCI_DAQ_Stop ( WORD id );
LIBOPTO int OptoPCI_DAQ_HalfReady ( WORD id, BOOL *HalfReady );
LIBOPTO int OptoPCI_DAQ_Transfer ( WORD id, WORD *mprVal, double *mprValChan0, double *mprValChan1, double *mprValChan2, double *mprValChan3 );
LIBOPTO int OptoPCI_DAQ_Poll ( WORD id, WORD *mprVal, double *mprValChan0, double *mprValChan1, double *mprValChan2, double *mprValChan3 );
LIBOPTO int OptoPCI_DAQ_DlgSetup ( PARAMETER_OPTOPCI *ParamDlg, HWND hWndParent, char* helpPath );
LIBOPTO int OptoPCI_DAQ_DlgAutoZero ( PARAMETER_OPTOPCI *ParamDlg, HWND hWndParent, char* helpPath );
LIBOPTO int OptoPCI_DAQ_SensorParam ( WORD id, WORD channel, WORD len, void *param);/* ------------------------------------------------------------------------ */
/* Function pointers Opto-PCI-Card IF 2004                                  */
/* ------------------------------------------------------------------------ */typedef int (*OPTO_OPENDRIVER)(char szShortPath[260]);
typedef int (*OPTO_CLOSEDRIVER)();
typedef int (*OPTO_DAQ_INFO)(VXD_VERSION_INFO *VersionInfo);
typedef int (*OPTO_DAQ_PARAMETER)(WORD id, WORD ChanNo, WORD ChanPos[4], UINT SensorType[4], UINT SensorRange[4], double Autozero[4], WORD BlockSize, BOOL encoderOnFIFO, BOOL useGate, WORD sensor);
typedef int (*OPTO_DAQ_ENCODERPARAM)(WORD id, WORD clock, WORD countingMode, BOOL changeDir, BOOL invert, WORD startValue, WORD refSetting, WORD refValue);
typedef int (*OPTO_DAQ_ENCODEREXCHANGE)(WORD id, WORD fkt, WORD *value);
typedef int (*OPTO_DAQ_SETAVERAGE)(WORD id, BOOL enable[4], BOOL persistant[4], WORD average[4]);
typedef int (*OPTO_DAQ_START)(WORD id);
typedef int (*OPTO_DAQ_SYNC)();
typedef int (*OPTO_DAQ_STOP)(WORD id);
typedef int (*OPTO_DAQ_HALFREADY)(WORD id, BOOL *HalfReady);
typedef int (*OPTO_DAQ_TRANSFER)(WORD id, WORD *mprVal, double *mprValChan0, double *mprValChan1, double *mprValChan2, double *mprValChan3);
typedef int (*OPTO_DAQ_POLL)(WORD id, WORD *mprVal, double *mprValChan0, double *mprValChan1, double *mprValChan2, double *mprValChan3);
typedef int (*OPTO_DAQ_DLGSETUP)(PARAMETER_OPTOPCI *ParamDlg, HWND hWndParent, char* helpPath);
typedef int (*OPTO_DAQ_DLGAUTOZERO)(PARAMETER_OPTOPCI *ParamDlg, HWND hWndParent, char* helpPath);
typedef int (*OPTO_DAQ_SENSORPARAM)(WORD id, WORD channel, WORD len, void *param);/* ------------------------------------------------------------------------ */
/* Export functions optoNCDT 1800 Series                                    */
/* ------------------------------------------------------------------------ */typedef int (*ILD1800_DAQ_OPEN)(UINT uiCom, UINT uiInterface);
typedef int (*ILD1800_DAQ_CLOSE)(UINT uiCom);
typedef int (*ILD1800_DAQ_INFO)(VXD_VERSION_INFO *VersionInfo);
typedef int (*ILD1800_DAQ_PARAMETER)(UINT uiCom, UINT SensorType, UINT SensorRange, UINT BlockSize, UINT COMInputSize, UINT COMOutputSize, BOOL InpOverflow, BOOL OutOverFlow, BOOL OutOfRange, double AutoZero);
typedef int (*ILD1800_DAQ_START)(UINT uiCom);
typedef int (*ILD1800_DAQ_STOP)(UINT uiCom);
typedef int (*ILD1800_DAQ_GETSTATUS)(UINT uiCom);
typedef int (*ILD1800_DAQ_HALFREADY)(UINT uiCom, BOOL *HalfReady);
typedef int (*ILD1800_DAQ_TRANSFER)(UINT uiCom, double *mprVal, double *mprValBits);
typedef int (*ILD1800_DAQ_POLLING)(UINT uiCom, double *dValue, double *dValueScaled);
typedef int (*ILD1800_DAQ_SETAVERAGE)(UINT uiCom, UINT uiType, UINT uiAvg);
typedef int (*ILD1800_DAQ_RESETCOMMAND)(UINT uiCom);
typedef int (*ILD1800_DAQ_ZEROCOMMAND)(UINT uiCom);
typedef int (*ILD1800_DAQ_DLGAUTOZERO)(PARAMETER *ParamDlg, HWND hWndParent, char* helpPath);
typedef int (*ILD1800_DAQ_DLGFRONTEND)(UINT uiCom, UINT uiInterface, HWND hWndParent, char* helpPath);
typedef int (*ILD1800_DAQ_DLGINFORMATION)(UINT uiCom, UINT uiInterface, HWND hWndParent, char* helpPath);
typedef int (*ILD1800_DAQ_DLGSETUP)(PARAMETER *ParamDlg, HWND hWndParent, char* helpPath);/* ------------------------------------------------------------------------ */
/* Function pointers optoNCDT 1800 Series                                   */
/* ------------------------------------------------------------------------ */LIBOPTO int ILD1800_DAQ_Open ( UINT uiCom, UINT uiInterface );
LIBOPTO int ILD1800_DAQ_Close ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_Info ( VXD_VERSION_INFO *VersionInfo );
LIBOPTO int ILD1800_DAQ_Parameter ( UINT uiCom, UINT SensorType, UINT SensorRange, UINT BlockSize, UINT COMInputSize, UINT COMOutputSize, BOOL InpOverflow, BOOL OutOverFlow, BOOL OutOfRange, double AutoZero );
LIBOPTO int ILD1800_DAQ_Start ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_Stop ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_GetStatus ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_HalfReady ( UINT uiCom, BOOL *HalfReady );
LIBOPTO int ILD1800_DAQ_Transfer ( UINT uiCom, double *mprVal, double *mprValBits );
LIBOPTO int ILD1800_DAQ_Polling ( UINT uiCom, double *dValue, double *dValueScaled );
LIBOPTO int ILD1800_DAQ_SetAverage ( UINT uiCom, UINT uiType, UINT uiAvg );
LIBOPTO int ILD1800_DAQ_ResetCommand ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_ZeroCommand ( UINT uiCom );
LIBOPTO int ILD1800_DAQ_DlgAutoZero ( PARAMETER *ParamDlg, HWND hWndParent, char* helpPath );
LIBOPTO int ILD1800_DAQ_DlgFrontEnd ( UINT uiCom, UINT uiInterface, HWND hWndParent, char* helpPath );
LIBOPTO int ILD1800_DAQ_DlgInformation ( UINT uiCom, UINT uiInterface, HWND hWndParent, char* helpPath );
LIBOPTO int ILD1800_DAQ_DlgSetup ( PARAMETER *ParamDlg, HWND hWndParent, char* helpPath );

解决方案 »

  1.   

    我在vb中改成了
    Public Declare Function OptoPCI_CloseDriver Lib "LibOpto.dll" () As Integer
    Public Declare Function OptoPCI_OpenDriver Lib "LibOpto.dll" (ByVal szShortPath As String) As IntegerPublic Declare Function OptoPCI_DAQ_EncoderExchange Lib "LibOpto.dll" (ByVal id As Long, ByVal fkt As Long, ByVal value As Long) As Integer
    Public Declare Function OptoPCI_DAQ_EncoderParam Lib "LibOpto.dll" (ByVal id As Long, ByVal clock As Long, ByVal countingMode As Long, ByVal changeDir As Boolean, ByVal invert As Boolean, ByVal startValue As Long, ByVal refSetting As Long, ByVal refValue As Long) As Integer
    Public Declare Function OptoPCI_DAQ_HalfReady Lib "LibOpto.dll" (ByVal id As Long, ByVal HalfReady As Boolean) As Integer
    Public Declare Function OptoPCI_DAQ_Info Lib "LibOpto.dll" (ByVal VersionInfo As String) As Integer
    Public Declare Function OptoPCI_DAQ_Parameter Lib "LibOpto.dll" (ByVal id As Long, ByVal ChanNO As Long, ByVal ChanPos As Long, ByVal SensorType As Long, ByVal SensorRange As Long, ByVal Autozero As Double, ByVal BlockSize As Long, ByVal encoderOnFIFO As Boolean, ByVal useGate As Boolean, ByVal sensor As Long) As Integer使用 ret = OptoPCI_OpenDriver("c:\winnt\system32\IF2DAQ.VXD")
    出现调用dll约定错误!怎么解决呀?
      

  2.   

    这是一个函数的原型3.1.1 OptoPCI_OpenDriver
    Prototype
    int OptoPCI_OpenDriver (char szShortPath[260] )
    Function parameters
    Direction Name Type Meaning
    Transfer szShortPath char For Win95, Win98 and WinME path
    specification where the VxD driver
    is located on the computer
    (necessary if it is not in the same
    path and not listed in the system
    directory)
    ReturnExplanation of function parametersFunction return
    DRV_ERR_OK, DRV_ERR_NOVDALOGD
    C
    #include “LibOpto.h"
    char szShortPath[260];
    int iRet = API__OptoPCI_OpenDriver( szShortPath );
    if (iRet == DRV_ERR_NOVDALOGD)
    {
    printf("Error on opening the driver");
    }
    Recommendation
    Use in the Init section
      

  3.   

    声明全错
    vc的int对应vb的long
    vc的UINT和WORD DWORD还有BOOL和一些指针都对应vb的long