CANblueII CANblueCon interactive mode via VBA

Hello,

I am actually trying to get an interactive connection between CANblueII and VBA.
To connect with the specified port and to call the interactive session I use:

Dim str_command as String
Dim dbl_PID as Double
str_command=“CANblueCon.exe 6”
dbl_PID=Shell(str_command, vbNormalFocus)

This establishes a connection to the CANblueII.

But how can I:
send further commands via the established connection, e.g. C CONFIG SHOW and also get the returned values from the commands?

Thanks a lot for any help,
Dirk

Hi Dirk,

Are you setting this up as a Generic PC Interface or as a Bridge?

… one little mistake in the code extract:

“C can_init” -> “C can_init” & vbCr

Hello,

I am trying to set it up as Generic PC interface. In between I am able to keep sending commands to the once opened command window via SendMessage from user32. But still I am not able to retrieve
any return value from the window. For that any help would really be helpful.

Private Declare Function SendMessage Lib “user32” Alias “SendMessageW” _

(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

For i = 1 To Len(“C can_init”)

SendMessage hWnd, WM_CHAR, Asc(Mid(“C can_init”), i, 1)), 0&

‘how to get the proper return value???

Next

If I can succeed, then I will provide the VBA project for sharing.

Thanks,

Dirk

Hey Dirk,

Sorry for the delay on this. It seems like there was an issue in our ticket escalation system. I just heard back from my colleague.

You can use the “CANblueCon” for the manually configuration and
for the manually transmission and reception.

Your application should open the serial port 6
"
Baudrate 921600
Data bits 8
Parity Bit none
Stop bits 1
Flow control hardware
"
and write and read the ASCII commands to and from the COM port.
See the attached screenshot.

Hi Dirk,

Just wanted to see if this is still an issue or if I can close out this ticket?

Thanks,
-Tim