i have 1 function that give me an array of a line points...
on these array, how can i get the array size without using the UBound() and LBound()?

Recommended Answers

All 6 Replies

I'm going to write you may have left out why you are not using UBound() and LBound(). Maybe the array is uninitialized but you failed to reveal that and this is your real question about how to handle that.

Read https://www.daniweb.com/programming/software-development/threads/233842/try-catch-feature-for-vb6-vba-vbscript where the On Error is mentioned along with a Try Catch solution to handle a failed U or L Bound().

my problem is graphics.. very slow, even using DIB's... i'm trying win more speed, but isn't easy :(

Let me comment it's been over a decade since I tried a DirectX library for Visual Basic 6 BUT it did help. I bought said library, book and CD at some technical book store sometime in the years 2000 to 2005. I can't recall what it's title was but it did tap what juice DirectX could offer and was 10 to 100 times faster than raw VB6.

Other thoughts.

  1. DirectX tutorials are out there such as https://gamedev.net/forums/topic/430026-directx-with-visual-basic-6/430026/
  2. If a code area is slow, I used my thoughts about how things work. That is, if I need the array size then I precompute that outside the heavy loops.
  3. If sin() and cos() are used I would precompute a lookup table. However I don't do that on PCs anymore since most PCs are GHz and more so the speed payoff isn't as much as it used to be. Story time: This was back in the 1990's and folk were impressed with this trick's performance boost which was on the order of 100 times.
  4. If you are doing graphic work, demand a dedicated graphics card. No matter which Intel/AMD with onboard graphics, all were many times slower than dedicated graphics.

let me ask 2 things:
1 - i never used Directx, but it's best start 8 or 9 version?(yes i can use both on my VB6)
yes Directx seems a little complex, so i must start from begining until i start it ;)
2 - why the GDI and GDI+ functions don't use GPU?
Moderator: please change the topic title to "VB6: how we get more speed on Graphics?"

commented: Your other post is about that indirectly. Here, you lead with something else. +15

As to VB6: how we get more speed on Graphics? my answer has two answers.

  1. Move to another dev system.
  2. Consider that graphics speed is not always possible if the host PC does not have dedicated graphics.

Furthermore VB6 is a legacy system. This is no expectation it will leverage what a modern PC has. Yet you will encounter crusty demanding older developers that will insist it "should have" or "should use" the GPU and more. Best to nod and let them be.

Your other post is actually more on point about speed but I neglected to write about testing if that's the speed bottleneck (the loops and the U and L bound calls.) I don't do this work for others but at work I had to profile our app to determine where the bottlenecks were so we knew where to look for the optimizing.

How do you know the U and L bound calls are the speed hits here and not the more usual areas? Did you profile and measure the times spent on each operation?

PS. If the discussion title is changed I must remove some of my answers as they would no longer apply. My vote is to leave the title as-is. My suggestion is that you work on your other post where the code was revealed as well as discuss and reveal what the host PC looks like. Sometimes I've run into developers that are on decade plus old dual core PCs with onboard graphics. We try their app on one of our office dev systems and the performance is fine.

"PS. If the discussion title is changed I must remove some of my answers as they would no longer apply. My vote is to leave the title as-is. My suggestion is that you work on your other post where the code was revealed as well as discuss and reveal what the host PC looks like. Sometimes I've run into developers that are on decade plus old dual core PCs with onboard graphics. We try their app on one of our office dev systems and the performance is fine."
now i can't edit it... moderator maybe see these next message.

"How do you know the U and L bound calls are the speed hits here and not the more usual areas? Did you profile and measure the times spent on each operation?"
i don't know.. but i win severy speed.... but i need more help.... so i will create a new topic ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.