"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 that shipped with Visual Basic 5, let alone looked through the source code. If you have Visual Basic 5, let's see if I can tempt you to browse this valuable resource. VISDATA.BAS contains the following routines. Could they be useful?
| ActionQueryType | AddBrackets | AddMRU |
| CheckTransPending | ClearDataFields | CloseAllRecordsets |
| CloseCurrentDB | CompactDB | CopyData |
| CopyStruct | DisplayCurrentRecord | DupeTableName |
| Export | GetFieldType | GetFieldWidth |
| GetINIString | GetODBCConnectParts | GetTableList |
| HideDBTools | Import | ListItemNames |
| LoadINISettings | NewLocalISAM | MakeTableName |
| MsgBar | OpenLocalDB | NewMDB |
| ObjectExists | RefreshErrors | OpenQuery |
| OpenTable | SetFldProperties | RefreshTables |
| SaveINISettings | ShowError | SetQDFParams |
| ShowDBTools | StripConnect | ShutDownVisData |
| StripBrackets | StripOwner | StripFileName |
| StripNonAscii | stTrueFalse | UnloadAllForms |
| vFieldVal |
There's more! The BAS files in the SETUP1 project contain these routines-anything useful in here?
| AbortAction | AddActionNote | AddDirSep |
| AddHkeyToCache | AddPerAppPath | AddQuotesToFN |
| AddURLDirSep | CalcDiskSpace | CalcFinalSize |
| CenterForm | ChangeActionKey | CheckDiskSpace |
| CheckDrive | CheckOverwrite-PrivateFile | CommitAction |
| CopyFile | CopySection | CountGroups |
| CountIcons | CreateIcons | CreateOSLink |
| CreateProgManGroup | CreateProgManItem | CreateShellLink |
| DecideIncrement-RefCount | DetectFile | DirExists |
| DisableLogging | EnableLogging | EtchedLine |
| ExeSelfRegister | ExitSetup | Extension |
| fCheckFNLength | fCreateOS-ProgramGroup | fCreateShellGroup |
| FileExists | fIsDepFile | fValidFilename |
| FValidNT-GroupName | fWithinAction | GetAppRemo-valCmdLine |
| GetDefMsgBoxButton | GetDepFileVerStruct | GetDiskSpaceFree |
| GetDrivesAllocUnit | GetDriveType | GetFileName |
| GetFileSize | GetFileVersion | GetFileVerStruct |
| GetGroup | GetLicInfoFromVBL | GetPathName |
| GetRemoteSupport-FileVerStruct | GetTempFilename | GetUNCShareName |
| GetWindowsDir | GetWindowsSysDir | GetWinPlatform |
| IncrementRefCount | InitDiskInfo | intGetHKEYIndex |
| IntGetNextFldOffset | IsDisplayNameUnique | IsNewerVer |
| IsSeparator | IsUNCName | IsValidDestDir |
| IsWin32 | IsWindows95 | IsWindowsNT |
| IsWindowsNT4-WithoutSP2 | KillTempFolder | LogError |
| LogNote | LogSilentMsg | LogSMSMsg |
| LogWarning | LongPath | MakeLongPath |
| MakePath | MakePathAux | MoveAppRemovalFiles |
| MsgError | MsgFunc | MsgWarning |
| NewAction | NTWithShell | PackVerInfo |
| ParseDateTime | PerformDDE | Process-CommandLine |
| PromptForNextDisk | ReadIniFile | ReadProtocols |
| ReadSetupFileLine | ReadSetupRemoteLine | RegCloseKey |
| RegCreateKey | RegDeleteKey | RegEdit |
| RegEnumKey | RegisterApp-RemovalEXE | RegisterDAO |
| RegisterFiles | RegisterLicense | RegisterLicenses |
| RegisterVBLFile | RegOpenKey | RegPathWin-CurrentVersion |
| RegPathWinPrograms | RegQueryNumericValue | RegQueryRefCount |
| RegQueryStringValue | RegSetNumericValue | RegSetStringValue |
| RemoteRegister | RemoveShellLink | ReplaceDouble-Quotes |
| ResolveDestDir | ResolveDestDirs | ResolveDir |
| ResolveResString | RestoreProgMan | SeparatePath-AndFileName |
| SetFormFont | SetMousePtr | ShowLoggingError |
| ShowPathDialog | SrcFileMissing | StartProcess |
| StrExtractFile-nameArg | strExtractFilenameItem | strGetCommon-FilesPath |
| StrGetDAOPath | strGetDriveFromPath | strGetHKEYString |
| StrGetPredefined-HKEYString | strGetProgramsFilesPath | StringFromBuffer |
| StripTerminator | strQuoteString | strRootDrive |
| StrUnQuoteString | SyncShell | TreatAsWin95 |
| UpdateStatus | WriteAccess | WriteMIF |