“Borrowing” Code
Steal code whenever possible. Why write the code yourself if you can source it from elsewhere? Have you checked out MSDN and all the sample code it provides for an answer? The samples in particular contain some great (and some not so great) pieces of code. Unfortunately, some programmers have never discovered the VisData sample (VB\samples\VisData) let alone looked through its source code. Let’s see if I can tempt you to browse this valuable resource. VISDATA.BAS contains the following routines. Could they be useful?
ActionQueryType |
MsgBar |
AddBrackets |
NewLocalISAM |
AddMRU |
NewMDB |
CheckTransPending |
ObjectExists |
ClearDataFields |
OpenLocalDB |
CloseAllRecordsets |
OpenQuery |
CloseCurrentDB |
OpenTable |
CompactDB |
RefreshErrors |
CopyData |
RefreshTables |
CopyStruct |
SaveINISettings |
DisplayCurrentRecord |
SetFldProperties |
DupeTableName |
SetQDFParams |
Export |
ShowDBTools |
GetFieldType |
ShowError |
GetFieldWidth |
ShutDownVisData |
GetINIString |
StripBrackets |
GetODBCConnectParts |
StripConnect |
GetTableList |
StripFileName |
HideDBTools |
StripNonAscii |
Import |
StripOwner |
ListItemNames |
stTrueFalse |
LoadINISettings |
UnloadAllForms |
MakeTableName |
vFieldVal |
There’s more! The BAS files in the SETUP1 project (VB\setupKit\setup1) contain these routines anything useful in here?
AbortAction |
DllEnableLogging |
AddActionNote |
DllLogError |
AddDirSep |
DllLogNote |
AddHkeyToCache |
DllLogWarning |
AddPerAppPath |
DllNewAction |
AddQuotesToFN |
DLLSelfRegister |
AddURLDirSep |
EnableLogging |
AllocUnit |
EtchedLine |
CalcDiskSpace |
ExeSelfRegister |
CalcFinalSize |
ExitSetup |
CenterForm |
Extension |
ChangeActionKey |
fCheckFNLength |
CheckDiskSpace |
fCreateOSProgramGroup |
CheckDrive |
fCreateShellGroup |
CheckOverwritePrivateFile |
fDllWithinAction |
CommitAction |
FileExists |
ConcatSplitFile |
fIsDepFile |
CopyFile |
fNTWithShell |
CopySection |
FSyncShell |
CountIcons |
fValidFilename |
CreateIcons |
fValidNTGroupName |
CreateOSLink |
fWithinAction |
CreateProgManGroup |
GetAppRemovalCmdLine |
CreateProgManItem |
GetClsidFromActXFile |
CreateShellLink |
GetDefMsgBoxButton |
DecideIncrementRefCount |
GetDepFileVerStruct |
DetectFile |
GetDiskSpaceFree |
DirExists |
GetDrivesAllocUnit |
DisableLogging |
GetDriveType |
DiskSpaceFree |
GetFileName |
DllAbortAction |
GetFileSize |
DllAddActionNote |
GetFileVersion |
DllChangeActionKey |
GetFileVerStruct |
DllCommitAction |
GetLicInfoFromVBL |
DllDisableLogging |
GetLongPathName |
GetPathName |
PackVerInfo |
GetRemoteSupportFileVerStruct |
ParseDateTime |
GetShortPathName |
PerformDDE |
GetTempFilename |
ProcessCommandLine |
GetUNCShareName |
PromptForNextDisk |
GetWindowsDir |
ReadIniFile |
GetWindowsSysDir |
ReadProtocols |
GetWinPlatform |
ReadSetupFileLine |
IncrementRefCount |
ReadSetupRemoteLine |
InitDiskInfo |
RegCloseKey |
intGetHKEYIndex |
RegCreateKey |
intGetNextFldOffset |
RegDeleteKey |
IsDisplayNameUnique |
RegEdit |
IsNewerVer |
RegEnumKey |
IsUNCName |
RegisterAppRemovalEXE |
IsValidDestDir |
RegisterDAO |
IsWin32 |
RegisterFiles |
IsWindows95 |
RegisterLicense |
IsWindowsNT |
RegisterLicenses |
IsWindowsNT4WithoutSP2 |
RegisterTLB |
lmemcpy |
RegisterVBLFile |
LogError |
RegOpenKey |
LogNote |
RegPathWinCurrentVersion |
LogSilentMsg |
RegPathWinPrograms |
LogSMSMsg |
RegQueryNumericValue |
LogWarning |
RegQueryRefCount |
MakePath |
RegQueryStringValue |
MakePathAux |
RegSetNumericValue |
MoveAppRemovalFiles |
RegSetStringValue |
MsgError |
RemoteRegister |
MsgFunc |
RemoveShellLink |
MsgWarning |
ReplaceDoubleQuotes |
NewAction |
ResolveDestDir |
OpenConcatFile |
ResolveDestDirs |
OSfCreateShellGroup |
ResolveDir |
OSfCreateShellLink |
ResolveResString |
OSfRemoveShellLink |
RestoreProgMan |
OSGetLongPathName |
SetFileDateTime |
SetFormFont |
strGetPredefinedHKEYString |
SetMousePtr |
strGetProgramsFilesPath |
SetTime |
StripTerminator |
ShowLoggingError |
strQuoteString |
ShowPathDialog |
strRootDrive |
SrcFileMissing |
strUnQuoteString |
strExtractFilenameArg |
TreatAsWin95 |
strExtractFilenameItem |
UCase16 |
strGetCommonFilesPath |
UpdateStatus |
StrGetDAOPath |
WriteAccess |
strGetDriveFromPath |
WriteMIF |
strGetHKEYString |
|
VB5STKIT.DLL, which contains some of the routines in the preceding list, is used by SETUP1.EXE, which the setup wizard includes for you on your distribution disks. It seems reasonable to me, then, to include it in your list of dependencies so that it gets installed on your customer’s machine. (It’s actually in the bootstrap, so it gets copied across anyway.) This all means that you can use the routines in this DLL in your own applications. (Keep in mind, however, that they’re documented only through their use in the SETUP1 source.)