#1 Burning Software

It is currently Fri Apr 26, 2024 10:01 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: GetDeviceInformation and VB
PostPosted: Wed Sep 15, 2004 1:53 am 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I'm having trouble getting the GetDeviceInformation to work with Visual Basic. Create seems to work ok, I get a 0 return code, by pointer has a value. When I call GetDeviceInformation, it fails. Here are my declares and call.

Declare Function StarBurn_CdvdBurnerGrabber_Create Lib "c:\windows\system32\StarBurn.dll" (ByRef ObjGrabber As Long, _
ByRef ExceptionText As String, ByVal TextSize As Long, ByRef SystemError As Long, _
ByRef PCDB_Fail_Info As CDB_Failure_Type, ByVal CallBack As Long, CallBackContext As Any, _
ByVal PortID As Byte, ByVal BusID As Byte, ByVal TargetID As Byte, ByVal LUN As Byte, _
ByVal CAcheSizeinMB As Long) As Long

Declare Function StarBurn_CdvdBurnerGrabber_GetDeviceInformation Lib "c:\windows\system32\StarBurn.dll" (ByVal ObjGrabber As Long, _
ByRef VendorID As String, ByRef ProductID As String, ByRef ProductRevisionLevel As String, _
ByRef BufferSizeInUchars As Long) As Long

CacheSize = 0
ExceptionText = Space(1024)
TextSize = 1024

rc = StarBurn_CdvdBurnerGrabber_Create(ObjGrabber, ExceptionText, TextSize, _
SystemError, CDB_Error_Info, AddressOf Create_CallBack, _
Null, D.PortID, D.Bus, D.Target, D.LUN, CacheSize)

VendorID = Space(1024)
ProductID = Space(1024)
ProductRevisionLevel = Space(1024)
BufferSize = 0
rc = StarBurn_CdvdBurnerGrabber_GetDeviceInformation(ObjGrabber, _
VendorID, ProductID, ProductRevisionLevel, BufferSize)

My call to FindDevice works fine. I get the same results as running your examples so the D object in the call represents a drive. D.PortID is the port ID returned from FindDevice etc.

I think it has something to do with the pointer to a pointer in the Create call but I'm not sure.


Top
 Profile  
 
 Post subject: pointer to strings
PostPosted: Wed Sep 15, 2004 9:48 am 
Offline

Joined: Mon May 31, 2004 6:22 am
Posts: 134
Hi,

You see, c++ code "char *" should be changed to VB code "ByVal XX As String"
And your VB code "ByRef XX As String" means "char **".

See fixed function declaration:
Code:
Declare Function StarBurn_CdvdBurnerGrabber_Create _
Lib "c:\windows\system32\StarBurn.dll" (ByRef ObjGrabber As Long, _
ByVal ExceptionText As String, ByVal TextSize As Long, ByRef _
SystemError As Long, _
ByRef PCDB_Fail_Info As CDB_Failure_Type, ByVal CallBack As Long, CallBackContext As Any, _
ByVal PortID As Byte, ByVal BusID As Byte, ByVal TargetID As Byte, ByVal LUN As Byte, _
ByVal CAcheSizeinMB As Long) As Long

Declare Function StarBurn_CdvdBurnerGrabber_GetDeviceInformation _
Lib "c:\windows\system32\StarBurn.dll" (ByVal ObjGrabber As Long, _
ByVal VendorID As String, ByVal ProductID As String, ByVal ProductRevisionLevel As String, _
ByRef BufferSizeInUchars As Long) As Long


Top
 Profile  
 
 Post subject: I thought I did that already
PostPosted: Wed Sep 15, 2004 1:03 pm 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I thought that was what I was doing. Did I make a mistake on one of them?


Top
 Profile  
 
 Post subject: I think I see now
PostPosted: Wed Sep 15, 2004 1:07 pm 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
After looking at your posting again, I realized you weren't just repeating what I had put in there. I'll change my declares and let you know. I must have gotten confused when I was doing this but I don't have a lot of experience converting C++ to VB.

Thank you for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 3:34 pm 
Offline

Joined: Mon May 31, 2004 6:22 am
Posts: 134
Hi,

I am so glad to hear that it's working now.
If you will have any other questions don't hesitate to contact me.

Have a nice day,
Alexey


Top
 Profile  
 
 Post subject: Not working yet
PostPosted: Wed Sep 15, 2004 5:37 pm 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
Sorry for the misunderstanding. I was just saying that after some more study, I understood your last post to me. I haven't had a chance to put the changes in the code yet. I hope to do that today.


Top
 Profile  
 
 Post subject: It is working now
PostPosted: Thu Sep 16, 2004 3:07 am 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I did get it working with your help. I got several other functions working too.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 1:55 pm 
Offline

Joined: Mon May 31, 2004 6:22 am
Posts: 134
Hi,

By the way,
You should change "ByRef ExceptionText As String" to
"ByVal ExceptionText As String", because when exception occured - you will get application crash.

I have seen the same wrong code in different functions:
StarBurn_CdvdBurnerGrabber_ProbeSupportedWriteModes
and StarBurn_CdvdBurnerGrabber_GetSpeeds

Bye


Top
 Profile  
 
 Post subject: Thank You
PostPosted: Mon Sep 20, 2004 1:29 am 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I had noticed I had the wrong from another post you put out there. I think I have that fixed everywhere now.


Top
 Profile  
 
 Post subject: Re: Thank You
PostPosted: Wed Oct 06, 2004 10:02 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Nice to hear the issue is gone :-)

bbriggstkd wrote:
I had noticed I had the wrong from another post you put out there. I think I have that fixed everywhere now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group