Rocket Division Software
http://www.starburnsoftware.com/forum/

Callback in VB
http://www.starburnsoftware.com/forum/starburn-sdk-f3/callback-t123.html
Page 1 of 1

Author:  bbriggstkd [ Mon Sep 06, 2004 1:53 pm ]
Post subject:  Callback in VB

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?

Author:  SpinDoctor [ Mon Sep 06, 2004 4:22 pm ]
Post subject: 

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

Author:  bbriggstkd [ Tue Sep 07, 2004 1:20 am ]
Post subject:  Making Progress

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?

Author:  anton (staff) [ Tue Sep 07, 2004 5:43 am ]
Post subject:  Re: Making Progress

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?

Author:  SpinDoctor [ Tue Sep 07, 2004 11:01 am ]
Post subject:  Re: Making Progress

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...

Author:  alexey (staff) [ Tue Sep 07, 2004 1:40 pm ]
Post subject:  Re: Making Progress

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?

Author:  bbriggstkd [ Tue Sep 07, 2004 3:58 pm ]
Post subject:  Looking Forward to Update

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.

Author:  anton (staff) [ Tue Sep 07, 2004 7:11 pm ]
Post subject:  Re: Looking Forward to Update

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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/