Callback interface using byte array
Callback interface using byte array
Callback interface using byte array
Callback interface using byte array
Callback interface using byte array
Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array
Callback interface using byte array Callback interface using byte array
Callback interface using byte array
Go Back  Xtreme Visual Basic Talk > > > Callback interface using byte array


Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2003, 04:37 AM
MrVideo
Guest
 
Posts: n/a
Default Callback interface using byte array


Hi,

i have created an interface that works as callback. An application implements this interface and delivers it to another object. The object calls the method ProcessBuffer(...) of the interface from time to time. This is working using Visual Basic .NET but not using Visual Basic 6. VB6 tells me: "Procedure declaration does not match description ...".

This is the interface method:
HRESULT ProcessBuffer( [in] long lInputSize, [in, size_is(lInputSize)]byte byInput[], [in] long lOutputSize, [in, size_is(lOutputSize)] byte byOutput[], [in] long lImageWidth, [in] long lImageHeight, [in] int iBitsPerPixel);

VB6 object browser shows me:
ProcessBuffer( lInputSize As Long, byInput As Byte, lOutputSize As Long, byOutput As Byte, lImageWidth As Long, lImageHeight As Long, iBitsPerPixel As Long);

It doesn't recognize my byte arrays. Isn't it possible to do this in VB6? Or do i have to use another interface definition?


Marc
Reply With Quote
  #2  
Old 03-06-2003, 04:54 AM
me_again's Avatar
me_again me_again is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Isando, South Africa
Posts: 233
Default

You can't pass arrays as parameters in VB6 unless you pass them as VARIANT - which is not supported by VB.NET
__________________
Real programmers code in binary! ;)
Reply With Quote
  #3  
Old 03-06-2003, 05:04 AM
Optikal's Avatar
OptikalCallback interface using byte array Optikal is offline
Codeaholic

Retired Leader
* Guru *
 
Join Date: Oct 2002
Location: Winnipeg, MB, Canada
Posts: 4,543
Default

Quote:
Originally Posted by me_again
You can't pass arrays as parameters in VB6 unless you pass them as VARIANT - which is not supported by VB.NET

that is untrue, VB6 can pass arrays as arguments (only ByRef though).


How are you implementing the interface, and how are you supplying the interface definition to VB?
__________________
There are 10 types of people in this world, those that understand binary, and those that don't.
Reply With Quote
  #4  
Old 03-06-2003, 05:12 AM
Flyguy's Avatar
FlyguyCallback interface using byte array Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,165
Default

Often you have to pass the first element of the array to act as the pointer: bInput(0)
Reply With Quote
  #5  
Old 03-06-2003, 05:13 AM
me_again's Avatar
me_again me_again is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Isando, South Africa
Posts: 233
Default

My appologies, I'm half asleep here!
__________________
Real programmers code in binary! ;)
Reply With Quote
  #6  
Old 03-06-2003, 05:41 AM
MrVideo
Guest
 
Posts: n/a
Default My type library

This is my type library, it is compiled using MIDL and registered using Regtlib.exe:

[
object,
uuid(7ACFA9DE-247A-48cb-ADF1-98233DB05DF5),
local,
helpstring("IMVBufferAccessCallback Interface"),
pointer_default(unique)
]
interface IMVBufferAccessCallback : IUnknown
{
[ helpstring("Process the current image buffer.")] HRESULT ProcessBuffer( [in ] long lInputSize,
[in, size_is(lInputSize) ] byte byInput[],
[in ] long lOutputSize,
[in, size_is(lOutputSize)] byte byOutput[],
[in ] long lImageWidth,
[in ] long lImageHeight,
[in ] int iBitsPerPixel);
}





[
uuid(5D8432C7-442F-4f1d-B412-3E1B5543EB5B),
helpstring("MV BufferAccessCallback Type Library"),
version(1.0)
]
library MVBufferAccessCallback
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

interface IMVBufferAccessCallback;

[
uuid(400A5075-22B0-46c0-8185-CAAA2755978B),
helpstring("MontiVision BufferAccessCallback Class")
]
coclass CMVBufferAccessCallback
{
[default] interface IMVBufferAccessCallback;
}
};
Reply With Quote
  #7  
Old 03-06-2003, 09:49 AM
MrVideo
Guest
 
Posts: n/a
Default Solution?

Hi again,

is there any error in my IDL, does anyone know what i have to change that VB6 accepts the ProcessBuffer() function?


Marc
Reply With Quote
  #8  
Old 03-06-2003, 10:07 AM
OnErr0r's Avatar
OnErr0rCallback interface using byte array OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

If you plan on passing using just the arrayname, you'll need to pass a SafeArray. Or you can just pass the first item, as FlyGuy mentioned.
Reply With Quote
  #9  
Old 03-06-2003, 10:17 AM
MrVideo
Guest
 
Posts: n/a
Default

The VB6 application will implement this interface and a C++ object will call the method ProcessBuffer(...). I don't know the size of the buffer, because it is an variable image buffer. So i have to use SafeArray type? I will try it that way.

Thanks for your suggestions!

Marc
Reply With Quote
  #10  
Old 03-06-2003, 11:07 AM
MrVideo
Guest
 
Posts: n/a
Cool Success

It works, thank you very much!

Marc
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Direct Memory Access to do Graphics BillSoo Tutors' Corner 3 07-11-2005 06:41 PM
Help: How to Recieve Byte array from C DLL ChubbyArse Miscellaneous Languages 1 02-21-2003 09:37 AM
copy memory from 2d array to 1d byte array Ptchaopr API 1 02-14-2003 04:09 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Callback interface using byte array
Callback interface using byte array
Callback interface using byte array Callback interface using byte array
Callback interface using byte array
Callback interface using byte array
Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array Callback interface using byte array
Callback interface using byte array
Callback interface using byte array
 
Callback interface using byte array
Callback interface using byte array
 
-->