Introduction and
Setup
Who this tutorial is aimed at:
The AVIFile functions allow programmers to work with AVI files
without resorting to using the lower level MMIO API functions - which requires
traversing up and down the individual "chunks" of data looking for the
specific bits you need. This tutorial is intended to help the advanced VB programmer learn how to use
the high level AVIFile functions which are included in all Win32 systems since
Win95. All projects have been tested in both VB5 and VB6 (and on Win2000
and Win98). It is my hope that this tutorial will provide
a much better understanding of how to use AVIs from VB than has previously been
available (believe me, I have searched for this information in the past and
there is a need). The sample programs discussed in this tutorial should
answer a large number of questions and hopefully provoke you to go beyond what is here. I am always
learning and I know that this is by no means the "last word" in programming AVIs
from VB. If you have useful information you want to share with me about
this topic, drop me a line. Bug reports are also welcome. You can
always contact me by email here -> <raymer@shrinkwrapvb.com>
but I make no guarantees about a timely response. See the How To Contact Me section at the
end for my suggestion on how to ask for free help.
Introduction to the mAVIDecs.bas file
Although I normally program with a very object-oriented style using self
contained classes as much as possible, I have found that for documentation
purposes it is easier to follow simple code fragments and short samples which do
not contain a lot of the overhead and "boiler-plate" code that is
normally contained in classes. Therefore, I have separated out most of the
AVI function declarations into a simple BAS module which you can include in a
new project and thus have access to all the WinAPI functions that a C programmer
would. This BAS module is actually just a translation of parts of the file
called Vfw.h which is required in C projects that use these functions. If
you ever experience problems or have questions about how I translated the
function declarations to VB, the best place to go is, of course, the Vfw.h file.
This is part of the Windows SDK and should also be located in the Includes
folder of your MS Visual C installation (assuming you have Visual Studio).
When I create a class to wrap functionality from certain Win APIs, I find that
it is very useful to have this kind of BAS "Library" of functions
which I can copy from. Perhaps in the next version of VB there will be
more intelligent support for linking in only the functions used from BAS files
similar to the way C header files work. This would eliminate the need for
cut and paste. But I digress...
Setting up for the tutorial
To get started, download the file mAVIDecs.bas now and copy it to a new
folder. Also copy the cFileDlg.cls file to this folder. Start up either VB5 or
VB6 and create a new project in this folder Add the 2 files you just
downloaded to
the project. Now
save the project and all files. At this point you should be ready to try
the exercises below. If you don't want to go through the full tutorial you
can skip to the end of the step and download the files in VB6 project format,
but since each step will build on the knowledge you gained in the previous one,
I recommend that even advanced programmers at least read through my notes to get
an idea of what caveats are involved before trying to modify the samples.
Go to the next step
Go back to the Table of Contents