#1 Burning Software

It is currently Tue Apr 23, 2024 8:16 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Callback in VB
PostPosted: Mon Sep 06, 2004 1:53 pm 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I'm trying to use the SDK using VB. I'm using the FindDevice function to get a list of the writer drives on the system. I can't seem to get the callback function to work. I get a 0 return code but the callback doesn't get called so I can't get the information. Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 4:22 pm 
Offline

Joined: Thu Jul 08, 2004 8:25 am
Posts: 51
Location: Germany
Triggering callbacks in VisualBasic I S very sophisticated, especially with void* handling...I did it once (I think it was the callback for Win-SDK-function EnumWindows() ) and I will look for the code, I once wrote for this. give me a day or two.
On the other hand, you could wait for the people at RocketDivision; I heard, they will provide an ActiveX-Control for such purposes, soon. With this, you can feel familiar with events resp. don't need to enum devices in your code...

Spin


Top
 Profile  
 
 Post subject: Making Progress
PostPosted: Tue Sep 07, 2004 1:20 am 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
I have gotten the callback function to work but I am now receiving another error. It is error 49, "Bad Dll calling convention"

Here is my vb delcaration for the function.

Declare Function StarBurn_FindDevice Lib "c:\windows\system32\StarBurn.dll" (ByVal DeviceType As Any, _
ByVal IsFindFirst As Boolean, ByVal CallBack As Long, CallBackContext As Any) As Long

the callback function looks like this

Public Sub ProcessCallBack(ByVal CallBackNum As Long, _
ByVal CallBackContext As Long, _
ByVal CallBackSpecial1 As Long, _
ByVal CallBackSpecial2 As Long)
End Sub

The error pops up when the program executes the End Sub command.

Have I gotten something declared wrong?


Top
 Profile  
 
 Post subject: Re: Making Progress
PostPosted: Tue Sep 07, 2004 5:43 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
I guess this is b/s StarBurn API is exported as STDCALL and VB has CDECL calling conventions by default :)

I'm not a big fan of VB so I'll ask Alex to check this. I think he'll write correct declaration of this stuff for you.

Thank you!

bbriggstkd wrote:
I have gotten the callback function to work but I am now receiving another error. It is error 49, "Bad Dll calling convention"

Here is my vb delcaration for the function.

Declare Function StarBurn_FindDevice Lib "c:\windows\system32\StarBurn.dll" (ByVal DeviceType As Any, _
ByVal IsFindFirst As Boolean, ByVal CallBack As Long, CallBackContext As Any) As Long

the callback function looks like this

Public Sub ProcessCallBack(ByVal CallBackNum As Long, _
ByVal CallBackContext As Long, _
ByVal CallBackSpecial1 As Long, _
ByVal CallBackSpecial2 As Long)
End Sub

The error pops up when the program executes the End Sub command.

Have I gotten something declared wrong?


Top
 Profile  
 
 Post subject: Re: Making Progress
PostPosted: Tue Sep 07, 2004 11:01 am 
Offline

Joined: Thu Jul 08, 2004 8:25 am
Posts: 51
Location: Germany
bbriggstkd wrote:
I have gotten the callback function to work but I am now receiving another error. It is error 49, "Bad Dll calling convention"

...

Public Sub ProcessCallBack(ByVal CallBackNum As Long, _
ByVal CallBackContext As Long, _
ByVal CallBackSpecial1 As Long, _
ByVal CallBackSpecial2 As Long)
End Sub

The error pops up when the program executes the End Sub command.

Have I gotten something declared wrong?


simply declare void pointers (void*) As Any (maybe also by ref, don't know, just try out) then it should work fine... Basic don't know much about pointers while in C/C++ a confersion from void* to INT_PTR or even Long is no problem...


Top
 Profile  
 
 Post subject: Re: Making Progress
PostPosted: Tue Sep 07, 2004 1:40 pm 
Offline

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

Yes, you are right, there is a problem with call back function. We will fix it and then inform you.

Thanks.
bbriggstkd wrote:
I have gotten the callback function to work but I am now receiving another error. It is error 49, "Bad Dll calling convention"

Here is my vb delcaration for the function.

the callback function looks like this

Public Sub ProcessCallBack(ByVal CallBackNum As Long, _
ByVal CallBackContext As Long, _
ByVal CallBackSpecial1 As Long, _
ByVal CallBackSpecial2 As Long)
End Sub

The error pops up when the program executes the End Sub command.

Have I gotten something declared wrong?


Top
 Profile  
 
 Post subject: Looking Forward to Update
PostPosted: Tue Sep 07, 2004 3:58 pm 
Offline

Joined: Mon Sep 06, 2004 1:45 pm
Posts: 118
Thank you for looking into this and helping me out.

I did a little searching and found out that VB does use the STDCALL convention by default. At least according to the information I found. I did find some code where I could use the CDECL method though.


Top
 Profile  
 
 Post subject: Re: Looking Forward to Update
PostPosted: Tue Sep 07, 2004 7:11 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
I'll complete OGG Vorbis support and this week (at least I hope so!) we'll release new version with CD-Text and OGG Vorbis support enabled. And we'll change calling convention for callback from CDECL -> STDCALL. To support VB in the "native" way. Existing users would have to recomple their projects (sorry for this!). Hold on...

bbriggstkd wrote:
Thank you for looking into this and helping me out.

I did a little searching and found out that VB does use the STDCALL convention by default. At least according to the information I found. I did find some code where I could use the CDECL method though.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 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