home *** CD-ROM | disk | FTP | other *** search
- 'API assorted functions
- Declare Function OutMessage% Lib "User" Alias "SendMessage" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
- Declare Function SendMessage& Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
- Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpBuffer$, ByVal nSize%)
- Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData As Any)
- Global Const HELP_CONTENTS = &H3
- Global Const HELP_PARTIALKEY = &H105
-
-
-
- 'program variables
- Global FormPassString As String 'used to pass strings
- Global FormPassString2 As String
-
- Global nl As String
-
- Global DisplayedMoveCtl As Integer
-
- Function BackSlashAdd (ThePath)
- 'adds a backslash (\) to a string, only if the rightmost
- 'character is not already a backslash
-
- ThisPath$ = ThePath
- If Right$(ThisPath$, 1) <> "\" Then
- ThisPath$ = ThisPath$ + "\"
- End If
- BackSlashAdd = ThisPath$
- End Function
-
- Function GetWinDir ()
- Buffer$ = Space$(255)
- count% = GetWindowsDirectory(Buffer$, 255)
- GetWinDir = Left$(Buffer$, count%)
- End Function
-
- Sub initialize ()
- nl = Chr$(13) + Chr$(10)
- End Sub
-
- Sub ListHscroll (TheListBox As Control, CharsWide%)
- If CharsWide% > 15000 Then CharsWide% = 15000
- LongString$ = String$(CharsWide%, "W")
- tppx% = Screen.TwipsPerPixelX
- MaxiWide% = TheListBox.Parent.TextWidth(LongString$) / tppx%
- HscrollLen& = SendMessage(TheListBox.hWnd, 1045, MaxiWide%, 0)
- End Sub
-
- Function replace (x, y, ReplaceString)
- 'replaces ALL occurences of y$ within x$ with ReplaceString
- 'for example, strip("abcdefabcedf","cde") = "abfabf"
-
- Dim z As String
-
- If Len(x) < 1 Or Len(y) < 1 Then
- replace = ""
- Exit Function
- End If
-
- If Len(ReplaceString) = 0 Then
- replace = x
- Exit Function
- End If
-
- z = x
- pos% = InStr(z, y)
- Do Until pos% = 0
- z = Left$(z, (pos% - 1)) + ReplaceString + Right$(z, Len(z) - Len(y) - pos% + 1)
- pos% = InStr(z, y)
- Loop
- replace = z
- End Function
-
- Function TrimAtNull (TheWord)
- 'Trims the string at the NULL character
- 'useful with most DLL's that change a string's value
-
- pos% = InStr(TheWord, Chr$(0))
- If pos% = 0 Then
- TrimAtNull = TheWord
- Else
- TrimAtNull = Left$(TheWord, pos% - 1)
- End If
- End Function
-
- Sub WaitFor (SecondsToWait%)
- If SecondsToWait > 59 Then SecondsToWait = 59
- ThisSecond% = Val(Format$(Now, "ss"))
- WaitUntil% = ThisSecond% + SecondsToWait
- If WaitUntil% > 59 Then
- WaitUntil% = WaitUntil% - 59
- End If
- LoopWait:
- NowSeconds% = Val(Format$(Now, "ss"))
- If NowSeconds% <> WaitUntil% GoTo LoopWait
- End Sub
-
-