Advanced Visual Basic 6: Power Techniques for Everyday Programs

Author: Matthew J. Curland
3.0
All Stack Overflow 7
This Month Stack Overflow 2

Comments

by teh_klev   2019-06-27
Matt Curland's "Advanced Visual Basic 6: Power Techniques for Everyday Programs: Hardcore Programming Techniques" was a cracker of a book as well back in the day:

https://www.amazon.co.uk/dp/0201707128

by anonymous   2017-08-20

Matt Curland, author of Advanced Visual Basic 6, who knows more about Visual Basic than most of us ever will, thinks it is wasted effort. Consider this quote (p110) about DAO, the COM data access library that primarily targets the Access Database Engine:

another example of poor teardown code. DAO has Close methods that must be called in the correct order, and the objects must be released in the correct order as well (Recordset before Database, for example). This single poor object model behavior has led to the misconception that VB leaks memory unless you explicitly set all the local variables to nothing at the end of a function. This is a completely false notion in a well-designed object model. VB can clear the variables faster at the End Sub line than you can from code, and it checks the variables even if you explicitly release your references. Any effort you make is duplicated.

by anonymous   2017-08-20

Do you need to call COM methods on this DLL? If so, I'm not at all sure this is possible.

by anonymous   2017-08-20

Column major. VB6 uses COM SAFEARRAYs and lays them out in column-major order. The fastest access is like this (although it won't matter if you only have 30x30 elements).

For i = 1 To 30 
    For j = 1 To 30 
        myarray (j, i) = something 
    Next 
Next 

If you really want to speed up your array processing, consider the tips in Advanced Visual Basic by Matt Curland, which shows you how to poke around inside the underlying SAFEARRAY structures.

For instance accessing a 2D SAFEARRAY is considerably slower than accessing a 1D SAFEARRAY, so in order to set all array entries to the same value it is quicker to bypass VB6's SAFEARRAY descriptor and temporarily make one of your own. Page 33.

You should also consider turning on "Remove array bounds checks" in the project properties compile options.