Stack Class for COM

What is a Stack Class?

A Stack data structure in programming is a last in, first out (LIFO) structure that stores data for a computer program in an ordered fashion. Data items can be placed in the Stack, pulled from the Stack, and the item on the top of the Stack is visible at any time. Unfortunately, but notably, Microsoft Visual Basic 6 (VB6), Microsoft Visual Basic for Applications (VBA), and other Microsoft COM (Component Object Model) languages do not provide the Stack data structure as a built-in feature in these languages. To fill this technology gap, ImagineThought.com has created the Stack Class for COM product for use with VB6, VBA, and other COM languages. To find out more about the Stack data structure, this Wikipedia article provides a really good and in-depth discussion of the Stack as it applies to programming languages.



Free Stack Class for COM, VBA, and VB6

Product Description:

The Stack Class for COM is the perfect solution to harnessing the power of the Stack data structure in your VBA, VB6, or other ActiveX COM code. The Stack Class for COM is primarily designed for use with Microsoft Office products, such as Microsoft Access and Excel, but will work with any development environment that supports linking to ActiveX COM DLLs. Once the StackClass.dll file has been referenced by your code project, you will be able to create and use unlimited instances of the Stack data structure throughout your VBA, VB6, or other COM code. The Stack Class for COM is the perfect solution for those needing the age old Stack data structure, which is missing from VBA and VB6.

Product Versions of the Stack Class for COM:

There are three different versions available for the Stack Class for COM product: the Developer Edition, the Redistributable Edition, and the Site License Edition. Each of these versions provides a slightly different set of features and licensing models, and each of which is discussed in detail below.

  1. Stack Class for COM – Developer Edition

    The Developer Edition is the free version of the Stack Class for COM and is everything you need to start using an developing against this product. However, this version may contain pop-up messages, stating that it is the demo edition of the product. The Developer Edition of the Stack Class for COM can be downloaded for free from here.

  2. Stack Class for COM – Redistributable Edition

    The Redistributable Edition is the fully licensed version of the Stack Class for COM product and does not include any pop-up messages during use. The Redistributable Edition also provides a license for developers to royalty-free redistribution of this product with their products, so that it can be used by an unlimited number of users. The Redistributable Edition also provides an number of tools to make it easy to incorporate into your setup routines. Please contact us directly for more information about the Redistributable Edition of the Stack Class for COM.

  3. Stack Class for COM – Site License Edition

    The Site License Edition is everything included in the Stack Class for COM product Redistributable Edition, but also includes a full resale license for the Stack Class for COM product as well. Please contact us directly for more information about the Site License Edition of the Stack Class for COM.

How to Use the Stack Class:

To begin using the Stack Class for COM in your code, there are a couple of things that must be completed first, and may vary, depending upon the edition of the product that you have purchased. In general, the following steps will work to install and get the Stack Class for COM registered on your Windows machine.

  1. Downloading the Stack Class for COM

    The Developer Edition of the Stack Class for COM can be downloaded from this site, however, you must purchase the Redistributable Edition before that specific version can be downloaded. When downloading the file, be sure to save it to a location that you can remember and access easily, i.e. your Desktop for example. Once the file has been downloaded, you must unzip the file you downloaded. It will contain an MSI file to setup the Stack Class for COM on your computer. Once the have the Stack Class for COM MSI setup file, you will be ready to run the setup routine to setup the Stack class on your computer.

  2. Installing the Stack Class for COM

    To install the MSI setup file for the Stack Class for COM product, simply double click on the file from Windows Explorer. This will start the Setup Wizard, which will walk you through the installation process. Upon successful completion of the Setup Wizard, the Stack Class for COM product will be installed and registered on your machine and ready to be referenced from within your code projects.

  3. Referencing the Stack Class for COM DLL

    Once the Stack Class for COM product has been installed, it will automatically be registered as a COM object on the machine and will be visible to programs which support linking to COM. Microsoft Access is a good example of a program that can reference the Stack Class for COM DLL. To reference the Stack class in Access, complete the following steps:

    1. Start Access and open an existing, or create a new, database.
    2. Press ALT+F11 to open the Visual Basic Editor (VBE).
    3. In VBE, choose the References option from the Tools menu to open the References dialog.
    4. In the References dialog, scroll down and check the box next to the Stack Class for COM option.
    5. Then click OK on the References dialog. The reference should now be set correctly for your VBA project.

    The Stack class will now be referenced in the code project for the Access database and you may begin creating and using instances of the Stack class.

  4. Creating an Instance of the Stack Class

    Once the Stack class has been referenced in the code project, you may begin creating instances of the Stack class in code. The following code provides an example of creating a new instance of the Stack class.

    ' VBA/VB6 Code
    ' Declare a new instance of the Stack class
    Dim stkMyStack As New Stack

    In the preceding code example, the variable named stkMyStack is created as a new instance of the Stack class. Now that you have an instance of the Stack class, you can begin using it to store data values.

  5. Calling the Methods of the Stack class from VBA code

    Finally, the last thing to do, once you have an instance of the Stack class, is to use it to store and retrieve data. The following code provides some examples of calling the methods of the Stack class.

    ' VBA/VB6 Code
    ' Declare a new instance of the Stack class
    Dim stkMyStack As New Stack

    ' Push the numeric value of 5 on to the Stack
    stkMyStack.Push(5)

    ' Peek at the top value on the Stack
    Dim vItem as Variant
    vItem = stkMyStack.Peek()

    ' Pop the top item off of the Stack
    vItem = stkMyStack.Pop()

    ' Clearing the Stack
    stkMyStack.Clear()

    ' Getting the Count of the items on the Stack
    Dim lngStackCount as Long
    lngStackCount = stkMyStack.Count

    In the preceding code, each of the specific member methods and properties of the Stack Class for COM have a code example to show how they can be used in code. Working with the methods and properties of the Stack Class for COM is just that easy! For more information about the Stack Class for COM, or it’s methods and properties, please see the product manual, which is included with every edition of the product.

System Requirements:

  • The Stack Class for COM requires one of the following versions of Microsoft Windows: Windows 95/98/2000/NT/ME/XP/2003/Vista/7/8/8.1/10
  • The Stack Class for COM requires that any environment linking to the StackClass.dll supports ActiveX COM.

These Tools are Designed For:

The Stack Class for COM is designed to work with the following products:

  1. Microsoft Office 95/97/2000/XP/2003/2007/2010/2013/365
  2. Microsoft Visual Studio 6.0/.NET/2003/2005/2008/2010/2012/2015