Test and Measurement Forum

ps2000_get_unit_info

Post your VB and VBA discussions here

ps2000_get_unit_info

Postby tim.coombs@zarlink.com » Wed Dec 16, 2009 5:04 pm

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?
tim.coombs@zarlink.com
 

Re: ps2000_get_unit_info

Postby ziko » Thu Dec 17, 2009 11:18 am

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

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

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: ps2000_get_unit_info

Postby timcoombs » Thu Dec 17, 2009 3:41 pm

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.
timcoombs
Newbie
 
Posts: 0
Joined: Thu Dec 17, 2009 3:32 pm

Re: ps2000_get_unit_info

Postby ziko » Fri Dec 18, 2009 2:09 pm

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 195 times
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests