ps2000_get_unit_info

Post your VB and VBA discussions here
Post Reply
tim.coombs@zarlink.com

ps2000_get_unit_info

Post by tim.coombs@zarlink.com »

This is a similar problem to the post on ps3000_get_unit_info. I have tried to use this function with VB6 and VB.net with no success, it just causes an application crash. This applies even when I use the code snippet shown in the ps3000 case. I have tried with both fixed and variable length strings.

I suspect it is to do with the way c and vb handle strings differently.

Anyone got any workable suggestions, please?

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: ps2000_get_unit_info

Post by ziko »

Hi try the file attached. It has an example in excel which works.

Kind regards
Attachments
ps2000.xls
(84 KiB) Downloaded 496 times
Ziko

Technical Specialist

timcoombs
Newbie
Posts: 0
Joined: Thu Dec 17, 2009 3:32 pm

Re: ps2000_get_unit_info

Post by timcoombs »

Ziko,

The attached file does not contain an example of using ps2000_get_unit_info, only the procedure declaration. I have no problems with the other functions and can use them happily, but get_unit info always crashes.

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: ps2000_get_unit_info

Post by ziko »

Hi yeah sorry just realised. It does contain the decleration however it needs to be modified. The following should be used:

Declare Function ps2000_get_unit_info Lib "ps2000.dll" (ByVal handle As Integer, ByVal str As String, ByVal lth As Integer, ByVal line_no As Integer) As Integer

If ByVal or ByRef are not chosen VB will by default select ByRef.

Please find a modified version of the example.

Kind regards
Attachments
ps2000.xls
(84 KiB) Downloaded 489 times
Ziko

Technical Specialist

Post Reply