View Single Post
Old 09-13-2004, 11:17 AM   #26
god_of_cpu
Raw Wave
 
god_of_cpu's Avatar
 
Join Date: Jan 2004
Location: SilverSpring Maryland
Posts: 2,957
Another problem is that you are also not allocating data for the packet before calling API_OBDII_Mode1_GetPacket.

You should add this stuff to your .bas file first:
Code:
Public Const API_OBDII_NUMHEADERBYTES = 3 Public Const API_OBDII_NUMDATABYTES = 7 Type API_OBDII_MSGPACKET m_dwTimeRecieved As Long m_iNumDataBytes As Byte m_Header(API_OBDII_NUMHEADERBYTES) as Byte m_Data(API_OBDII_NUMDATABYTES) as Byte End Type

Then you should declare lpMsgPacket as API_OBDII_MSGPACKET rather then longi.e.
Code:
Dim lpMsgPacket As API_OBDII_MSGPACKET

Also change the API_OBDII_Mode1_GetPacket declaration to reflect this and pass it in ByRef.

Code:
Public Declare Sub API_OBDII_Mode1_GetPacket Lib "OBDIIFaker.dll" (ByVal lpUser As Long, ByVal eOBDPID As Long, ByRef lpMsgPacket As API_OBDII_MSGPACKET)

To interpret the data in the packets you'll have to use the helper functions or port them to your own in VB.

This is why your program was crashing.
__________________
StreetDeck.com Developer (I am Chuck)
Get StreetDeck at http://www.streetdeck.com
The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

Last edited by god_of_cpu; 09-13-2004 at 11:45 AM.
god_of_cpu is offline   Reply With Quote