A Visual Basic 6 project is a folder of text files: a .vbp project file that lists the others, and one file per form, class, module, user control, property page, user document or designer. Where the file has a visual design (.frm, .ctl, .pag, .dob, .dsr) the design is written as a header of nested blocks before the code, so the file is a block-structured property list followed by ordinary VB6 code. Pictures, icons and long strings of the design live in a binary file with the same name and the extension .frx (.ctx for a control, .dox for a document), which these pages do not read.
The form header
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form DDTransparentBlt
BorderStyle = 3 'Fixed Dialog
Caption = "DD Transparency"
ClientHeight = 5070
BeginProperty Font
Name = "Courier New"
Size = 72
Italic = -1 'True
EndProperty
Icon = "DDtut2.frx":0000
MaxButton = 0 'False
Begin VB.PictureBox Picture1
FillStyle = 7 'Diagonal Cross
Height = 5055
TabIndex = 0
Top = 0
Width = 6495
End
End
Attribute VB_Name = "DDTransparentBlt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
End Sub
Object line added for the example): the header, the Attribute lines, then code.VERSION 5.00is the file format version of the designer file (VB 5 and 6 write 5.00; VB 3 forms sayVERSION 2.00and name their controls without a library prefix:Begin Form Form1,Begin TextBox Text1). Class modules sayVERSION 1.0 CLASS.Object = "{GUID}#major.minor#flags"; "file.ocx"lines name the ActiveX control libraries the design uses: the class library’s GUID, its version and a flag value, then the file name.Begin Library.Class Name…Endis one object. The firstBeginis the form (VB.Form,VB.MDIForm,VB.UserControl,VB.PropertyPage,VB.UserDocument, or a designer written as a GUID); blocks inside it are its controls, which can nest (a frame holds controls). The class is a ProgID such asVB.CommandButtonorVB.TextBox, or, for a third-party control, a GUID in braces followed by the name:Begin {C4145310-469C-11D1-B9E5-00AA00BD3B70} Name. A control that is part of a control array also has anIndex = nproperty.- Properties are
Name = valuelines, in the order the designer writes them (alphabetical by property name in the files read, with aBeginPropertyblock standing where its name falls). A value is a number, a string in double quotes (a doubled quote stands for one), a hexadecimal number (colours are&H00FFFFFF&; the high byte&H80means a system colour),-1for True and0for False (the editor adds a comment such as'Trueor'Fixed Dialogfor the readable form), or a reference into the.frxfile,"Form1.frx":0000: the file name and the hexadecimal offset of the data. BeginProperty Name…EndPropertyholds a property that is itself an object with properties, such as aFont(Name,Size,Charset,Weight,Underline,Italic,Strikethrough).- After the final
Endcome theAttribute VB_…lines (VB_Name,VB_GlobalNameSpace,VB_Creatable,VB_PredeclaredId,VB_Exposed), then the code of the form. Event procedures are namedControlName_Event(Command1_Click,Form_Load).
| Extension | The first block |
|---|---|
.frm | Begin VB.Form or Begin VB.MDIForm |
.ctl | Begin VB.UserControl |
.pag | Begin VB.PropertyPage |
.dob | Begin VB.UserDocument |
.dsr | Begin {GUID} Name for the designer (the Data Environment and Data Report designers have a different, binary-like content that is not described) |
.cls | VERSION 1.0 CLASS then BEGIN … END with class settings (see VB6 and VBA) |
Project and group files
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#StdOle2.tlb#OLE Automation
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=DDtut2.frm
Module=Module1; Module1.bas
Class=Class1; Class1.cls
Startup="DDTransparentBlt"
Title="ddtut2"
ExeName32="DDtut2.exe"
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
BoundsCheck=0
ThreadPerObject=0
MaxNumberOfThreads=1
Object, Module and Class lines added to show every kind).| Key | Meaning |
|---|---|
Type= | the project type: Exe (standard EXE), OleExe (ActiveX EXE), OleDll (ActiveX DLL), Control (ActiveX control) |
Reference= | a type library: *\G{GUID}#major.minor#lcid#path#description |
Object= | an ActiveX control library: {GUID}#major.minor#0; file.ocx |
Form=, MDIForm=, UserControl=, PropertyPage=, UserDocument=, Designer=, RelatedDoc=, ResFile32=, IconForm= | a file of the project, by path (with a name before the path for Module= and Class=: Module=Name; file.bas) |
Startup= | the startup form (in quotes) or Sub Main |
Title=, ExeName32=, Command32=, Name=, HelpFile=, HelpContextID=, Description= | the application title, output file, command-line arguments for the debugger, project name, help file and its context |
CompatibleMode= | binary compatibility of an ActiveX component (0 none, 1 project, 2 binary) |
MajorVer= MinorVer= RevisionVer= AutoIncrementVer= | the version resource; Version… keys (VersionCompanyName= …) add its strings |
CompilationType= OptimizationType= FavorPentiumPro(tm)= CodeViewDebugInfo= NoAliasing= BoundsCheck= OverflowCheck= FlPointCheck= FDIVCheck= UnroundedFP= | the compiler options (P-code or native code, optimisation, and the native-code checks; the values were not decoded) |
StartMode= Unattended= ThreadPerObject= MaxNumberOfThreads= ServerSupportFiles= Retained= | options of ActiveX components and servers |
[MS Transaction Server] | a section with AutoRefresh= for components that run under Microsoft Transaction Server |
A .vbg project group starts with VBGROUP 5.0 and lists projects with Project=path.vbp lines and a StartupProject= line. The .vbw file beside a project (window positions of the editor) is also text-like but is not described.
Not described
Known, not yet covered
- Reference: there is no public specification of the form and project formats; the Visual Basic 6 documentation and the Open Specifications document [MS-VBAL] could not be fetched in this pass. These pages were written from reading real files: the 277 project files, 52 user controls, 1,500 forms (most of them not Visual Basic) and the sample projects found on this Mac. The meaning of the values of each property of each control (every property’s enumeration), the exact property order the designer uses, and the details of the
.frxbinary format were not worked out. - Reference: the values of
CompatibleMode(written from memory),CompilationTypeand the other compiler keys, the flags in anObjectline and the scaling of theFontSizewere not verified. - Viewer: the header is coloured line by line (keywords
Begin,End,BeginProperty,EndProperty,Object; class names as types; property names as variables; strings, numbers,"file.frx":offsetand comments); a header that has an unusual line ends the header at that point and the rest is read as code.
Unknown
- Reference: the layout of the
.frxfiles, the.vbwwindow files and the Data Environment and Data Report designer files (.dsrwith binary parts) was not worked out; searched: the Visual Basic and VBA documentation, the repositories downloaded for the viewer tests and the files on this Mac.
See also
- VB6 and VBA – the code part of these files
- Tooling – VB6 and the later project formats