Hello, I am trying to create a delegate for an upgrade but I am now getting this error: Method 'Public Function CamEventCallbackFunc(eventID As Integer, pData As Integer, DataSize As Integer, Context As Integer) As Integer' does not have the same signature as delegate 'Delegate Function DelegateCDRegisterEventCallbackFunction(hSource As Integer, pFunc As Integer, Context As Integer, ByRef hFunc As Integer) As Integer'. Delegate Function DelegateCDRegisterEventCallbackFunction(ByVal hSource As Integer, ByVal pFunc As Integer, ByVal Context As Integer, ByRef hFunc As Integer) As Integer Declare Function CDRegisterEventCallbackFunction Lib "CDSDK.dll" (ByVal hSource As Integer, ByVal pFunc As DelegateCDRegisterEventCallbackFunction, ByVal Context As Integer, ByRef hFunc As Integer) As Integer err_Renamed = CDRegisterEventCallbackFunction(m_hSource, AddressOf CamEventCallbackFunc, 100, m_hFunc)
Jay, Here is the code Public Function CamEventCallbackFunc(ByVal eventID As Integer, ByVal pData As Integer, ByVal DataSize As Integer, ByVal Context As Integer) As Integer m_CamEventID = eventID CamEventCallbackFunc = cdOK End Function John [quoted text, click to view] "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message news:%23KWVmL46DHA.2404@TK2MSFTNGP11.phx.gbl... > John, > What does the declaration of the CamEventCallbackFunc function look like? > > Is the last parameter ByRef or ByVal? > > Hope this helps > Jay > > "john" <jonashbaugh@hotmail.com> wrote in message > news:%23UdPrR26DHA.632@TK2MSFTNGP12.phx.gbl... > > Hello, > > > > I am trying to create a delegate for an upgrade but I am now getting > > this error: > > > > Method 'Public Function CamEventCallbackFunc(eventID As Integer, pData As > > Integer, DataSize As Integer, Context As Integer) As Integer' does not > have > > the same signature as delegate 'Delegate Function > > DelegateCDRegisterEventCallbackFunction(hSource As Integer, pFunc As > > Integer, Context As Integer, ByRef hFunc As Integer) As Integer'. > > > > Delegate Function DelegateCDRegisterEventCallbackFunction(ByVal hSource As > > Integer, ByVal pFunc As Integer, ByVal Context As Integer, ByRef hFunc As > > Integer) As Integer > > > > Declare Function CDRegisterEventCallbackFunction Lib "CDSDK.dll" (ByVal > > hSource As Integer, ByVal pFunc As > DelegateCDRegisterEventCallbackFunction, > > ByVal Context As Integer, ByRef hFunc As Integer) As Integer > > > > err_Renamed = CDRegisterEventCallbackFunction(m_hSource, AddressOf > > CamEventCallbackFunc, 100, m_hFunc) > > > > > > > >
John, What does the declaration of the CamEventCallbackFunc function look like? Is the last parameter ByRef or ByVal? Hope this helps Jay [quoted text, click to view] "john" <jonashbaugh@hotmail.com> wrote in message news:%23UdPrR26DHA.632@TK2MSFTNGP12.phx.gbl... > Hello, > > I am trying to create a delegate for an upgrade but I am now getting > this error: > > Method 'Public Function CamEventCallbackFunc(eventID As Integer, pData As > Integer, DataSize As Integer, Context As Integer) As Integer' does not have > the same signature as delegate 'Delegate Function > DelegateCDRegisterEventCallbackFunction(hSource As Integer, pFunc As > Integer, Context As Integer, ByRef hFunc As Integer) As Integer'. > > Delegate Function DelegateCDRegisterEventCallbackFunction(ByVal hSource As > Integer, ByVal pFunc As Integer, ByVal Context As Integer, ByRef hFunc As > Integer) As Integer > > Declare Function CDRegisterEventCallbackFunction Lib "CDSDK.dll" (ByVal > hSource As Integer, ByVal pFunc As DelegateCDRegisterEventCallbackFunction, > ByVal Context As Integer, ByRef hFunc As Integer) As Integer > > err_Renamed = CDRegisterEventCallbackFunction(m_hSource, AddressOf > CamEventCallbackFunc, 100, m_hFunc) > > >
John, The Context (4th parameter) on CamEventCallbackFunc is ByVal, the hFunc (4th parameter) on DelegateCDRegisterEventCallbackFunction is ByRef. You cannot mix ByVal with ByRef! They both need to be either ByVal or both ByRef! [quoted text, click to view] > Public Function CamEventCallbackFunc(ByVal eventID As Integer, ByVal pData > As Integer, ByVal DataSize As Integer, ByVal Context As Integer) As
Integer [quoted text, click to view] > > > Delegate Function DelegateCDRegisterEventCallbackFunction(ByVal hSource > As > > > Integer, ByVal pFunc As Integer, ByVal Context As Integer, ByRef hFunc > As > > > Integer) As Integer
Hope this helps Jay [quoted text, click to view] "john" <jonashbaugh@hotmail.com> wrote in message news:O3nnpP46DHA.3304@tk2msftngp13.phx.gbl... > Jay, > > Here is the code > > Public Function CamEventCallbackFunc(ByVal eventID As Integer, ByVal pData > As Integer, ByVal DataSize As Integer, ByVal Context As Integer) As Integer > > m_CamEventID = eventID > > CamEventCallbackFunc = cdOK > > End Function > > > > John > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message > news:%23KWVmL46DHA.2404@TK2MSFTNGP11.phx.gbl... > > John, > > What does the declaration of the CamEventCallbackFunc function look like? > > > > Is the last parameter ByRef or ByVal? > > > > Hope this helps > > Jay > > > > "john" <jonashbaugh@hotmail.com> wrote in message > > news:%23UdPrR26DHA.632@TK2MSFTNGP12.phx.gbl... > > > Hello, > > > > > > I am trying to create a delegate for an upgrade but I am now getting > > > this error: > > > > > > Method 'Public Function CamEventCallbackFunc(eventID As Integer, pData > As > > > Integer, DataSize As Integer, Context As Integer) As Integer' does not > > have > > > the same signature as delegate 'Delegate Function > > > DelegateCDRegisterEventCallbackFunction(hSource As Integer, pFunc As > > > Integer, Context As Integer, ByRef hFunc As Integer) As Integer'. > > > > > > Delegate Function DelegateCDRegisterEventCallbackFunction(ByVal hSource > As > > > Integer, ByVal pFunc As Integer, ByVal Context As Integer, ByRef hFunc > As > > > Integer) As Integer > > > > > > Declare Function CDRegisterEventCallbackFunction Lib "CDSDK.dll" (ByVal > > > hSource As Integer, ByVal pFunc As > > DelegateCDRegisterEventCallbackFunction, > > > ByVal Context As Integer, ByRef hFunc As Integer) As Integer > > > > > > err_Renamed = CDRegisterEventCallbackFunction(m_hSource, AddressOf > > > CamEventCallbackFunc, 100, m_hFunc) > > > > > > > > > > > > > > >
Don't see what you're looking for? Try a search.
|