|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Option Explicit
' Used in AUTO procedures as a prefix for a bookmark name
Public Const strcBookMark As String = "Auto"
' Used in DAO procedures as the default file extent for database files.
Public Const strDBExtent As String = "mdb"
Private Const intcBottomOfPage As Integer = 1
Private Const intcTopOfPage As Integer = -1
Private Const strcTOCRightAlign As String = "TOCRightAlign"
Private Const strcTOCHeadingStyles As String = "TOCHeadingStyles"
Private Const strcTOCLowerLevel As String = "TOCLowerLevel"
Private Const strcTOCLeader As String = "TOCLeader"
' INI: Should we be prompted before target directory files are overwritten?
Private Const strcOverWrite As String = "OverWrite"
Private Const strcOverWriteDefault As String = "N"
' Standard extent for an ASCII-based environment settings file.
Private Const strcExtentINI As String = ".INI"
' INI: reserved switch for an alternate source of INI file values.
Private Const strcEnvironmentPath As String = "EnvironmentPath"
' Set this switch to FALSE if tracing is to be globally suppressed.
Private Const boolcDebug As Boolean = True
' Use of this default constant should be replaced by the dynamic strEnvironmentPath variable.
Private Const strcUserPath As String = "c:\"
Private Const strcLogFile As String = "LogFile"
' INI file: Latest definition of the colour scheme.
Private Const strcColours As String = "Colours"
' INI file: default colour scheme when the user has exercised no choice.
Private Const strcDefaultColours As String = "0| 256| 36| 197| 251| 126| 54| 63| 195| 205| 152|"
Private Const intcBase As Integer = 256 ' For the RGB colour system.
Private Const intcMinimumListBoxWidth As Integer = 18 ' 1/4 inch minimum when squeezing.
Private strCodeTrans As String
Private strStandardLog As String
' Standard sverity codes.
Public Const intcErrorInform As Integer = 1 'Information only. e.g. "A style has been created"
Public Const intcErrorWarn As Integer = 2 ' Warning e.g. "Document exceeded date limitations and has been bypassed"
Public Const intcErrorSevere As Integer = 4 ' Severe e.g. "The Document was not made available to us"
Public Const intcErrorFatal As Integer = 8 ' Fatal e.g (I cannot think of a good example from outside this module!)
' I now support switching from the template host directory to a data directory.
' The key strcEnvironmentPatrh is reserved for this purpose.
'Public Const strcEnvironmentPath As String = "EnvironmentPath"
' Here is the extent I use, to conform to Windows standards.
' You could elect to use another extent, such as 'env" for ENVironment.
'Public Const strcExtentINI As String = ".INI"
' For this version which supports key values longer than 254 characters,
' I need to know where a record ends; typically ASC(10 & asc(13)
Public Const strcRecordDelimiter As String = vbCrLf
' For this version which supports key values longer than 254 characters,
' I need to know where a section identifier starts.
Public Const strcSectionStart As String = "["
' For this version which supports key values longer than 254 characters,
' I need to know where a section identifier ends.
Public Const strcSectionEnd As String = "]"
' For this version which supports key values longer than 254 characters,
' I need to know where a key name ends.
Public Const strcKeySeparator As String = "="
Private Const strcDelimiter As String = ","
Private Const strcDriveSeparator As String = ":" ' Aid in parsing a filename/path string.
Private Const strcPunctuation As String = "~!@#$%^&()-_{}" ' ref: PCMag "PCDos powerTools p 32"
' INI: user's choice of a flag to signal a tokenised table.
Private Const strcTokenFlag As String = "TokenFlag"
Private Const strcDefaultTokenFlag As String = "¥"
Private Const MAX_FILENAME_LEN = 256
Private Declare Function FindExecutableA Lib "shell32.dll" (ByVal lpFile As String, ByVal lpdirectory As String, ByVal lpResult As String) As Long
Const GFSR_SYSTEMRESOURCES = 0 ' for MsgFreeResources
Const GFSR_GDIRESOURCES = 1 ' for MsgFreeResources
Const GFSR_USERRESOURCES = 2 ' for MsgFreeResources
Private Declare Function GetFreeResources Lib "RSRC32" Alias "_MyGetFreeSystemResources32@4" (ByVal lWhat As Long) As Long ' for MsgFreeResources
Const PRINTER_ENUM_CONNECTIONS = &H4
Const PRINTER_ENUM_LOCAL = &H2
Type PRINTER_INFO_1
Flags As Long
pDescription As String
pName As String
PComment As String
End Type
Private Declare Function EnumPrinters Lib "winspool.drv" Alias "EnumPrintersA" (ByVal Flags As Long, ByVal Name As String, ByVal Level As Long, pPrinterEnum As Long, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Private Declare Function StrLen Lib "kernel32" Alias "lstrlenA" (ByVal Ptr As Long) As Long
Private Declare Function PtrToStr Lib "kernel32" Alias "lstrcpyA" (ByVal retval As String, ByVal Ptr As Long) As Long
' INI: key for sticky values holds the user's concept of available drives.
Private Const strcDriveLetters As String = "DriveLetters"
Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocationName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) ' for private Function Sleeper
' 32-bit API declaration for displaysysteminfo
Private Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
' 16-bit API declaration for displaysysteminfo
Private Declare Function GetSystemMetrics16 Lib "user" Alias "GetSystemMetrics" (ByVal nIndex As Integer) As Integer
Private Declare Function GetTickCount Lib "kernel32" () As Long ' For KevinTimer2
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long ' for PlaySound
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |