Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > VB Image buffer too big


Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2007, 09:59 PM
rjrodrig rjrodrig is offline
Newcomer
 
Join Date: May 2007
Posts: 2
Unhappy VB Image buffer too big


Hi all,

I would appreciate your help on this topic. I have a DLL function that looks like this GetCurrentFrame(int CamHandle, int FrameType, BYTE *Buffer), and it returns a very large buffer for a 1.3MPix image. The image is structured in a 1-D array of BGR bytes all sequential. So the total array size is 1280x1024*3=3,932,160 byte elements.

I tried redim myBuff(0 to 3932159) this works fine in VB. When I try

Global ImgSize as long

ImgSize = (1024*1280*3)

The VB6 compiler complains for overflow; the answer is too big and does not fit. It should fit up to 2 billion, why is VB complaining ? Does any one know how to solve this problem?

Regards,
rjrodrig
Reply With Quote
  #2  
Old 05-27-2007, 10:38 PM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

Quote:
Originally Posted by rjrodrig View Post
Hi all,

I would appreciate your help on this topic. I have a DLL function that looks like this GetCurrentFrame(int CamHandle, int FrameType, BYTE *Buffer), and it returns a very large buffer for a 1.3MPix image. The image is structured in a 1-D array of BGR bytes all sequential. So the total array size is 1280x1024*3=3,932,160 byte elements.

I tried redim myBuff(0 to 3932159) this works fine in VB. When I try

Global ImgSize as long

ImgSize = (1024*1280*3)

The VB6 compiler complains for overflow; the answer is too big and does not fit. It should fit up to 2 billion, why is VB complaining ? Does any one know how to solve this problem?

Regards,
rjrodrig
Try ImgSize = (1024& * 1280 * 3)

And if that doesnt do it

ImgSize = CLng(1280 * 3) * 1024
Reply With Quote
  #3  
Old 05-29-2007, 03:37 PM
rjrodrig rjrodrig is offline
Newcomer
 
Join Date: May 2007
Posts: 2
Default

Thanks I figured it out too. It wants
ImgSize = 1280& * 1024& * 3&

This is so weird I have experienced that error before in all these year using VB6. Anyway, thanks for the response
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

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