View Single Post
Old 09-14-2004, 05:52 PM   #39
god_of_cpu
Raw Wave
 
god_of_cpu's Avatar
 
Join Date: Jan 2004
Location: SilverSpring Maryland
Posts: 2,957
Ok, I installed VB6 and got your code working.

The first change is that apparently VB declares arrays so you specify just the upper bound not the number of elements in the array as I thought. This means the API_OPDII_MSGPACKET type was incorrect it should be:

Code:
Type API_OBDII_MSGPACKET m_dwTimeRecieved As Long m_iNumDataBytes As Byte m_Header(0 To API_OBDII_NUMHEADERBYTES - 1) As Byte m_Data(0 To API_OBDII_NUMDATABYTES - 1) As Byte End Type

The reason why there was 205 all over the place was because the data array was never initialized. API_OBDII_Mode1_ResetData m_lpUser should be called before calling any AddOBDPID calls. The reason why you weren't getting good values in the m_Data varibles that were filled during the GetPacket call was because the type was incorrect.

You also need to call GetPacket for every OBD packet you need to retrieve
i.e.
Code:
API_OBDII_Mode1_GetPacket m_lpUser, eOBDPIDTimingAdvance, lpMsgPacket

The last thing I found was that you declared the strings as follows:
Code:
Dim szPlugInName, szPluginComment, szVersion As String

Since you didn't specify a type for PluginName and comment it made them variants. You need to explicitly specify the type after every vaible like so:
Code:
Dim szPlugInName As String Dim szPluginComment As String Dim szVersion As String

You should be able to retrive the name and comment with that now.


I have attached the updated VB code.
Attached Files
File Type: zip OBDII_VB6_Test.zip (7.6 KB, 229 views)
__________________
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.
god_of_cpu is offline   Reply With Quote