Declare Function GetPrivateProfileString% Lib "Kernel" (ByVal lpApplicationName As Any, ByVal lpKeyName As Any, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%, ByVal lpFileName$)
Declare Function GetProfileString% Lib "Kernel" (ByVal lpAppName$, ByVal lpKeyName As Any, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%)
Declare Function GetVersion Lib "Kernel" () As Integer
Declare Sub GetClientRect Lib "User" (ByVal hwnd As Integer, lpRect As Rect)
Declare Function GetFocus Lib "User" () As Integer
Declare Sub BringWindowToTop Lib "User" (ByVal hwnd As Integer)
Declare Function SetFocusAPI Lib "User" Alias "SetFocus" (ByVal hwnd As Integer) As Integer
#Else
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Declare Function WriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal lpszSection As String, ByVal lpszKeyName As String, ByVal lpszString As String) As Long
Declare Function GetProfileInt Lib "kernel32" Alias "GetProfileIntA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Long) As Long
Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As Any, ByVal lpDefault As Any, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Declare Function GetVersion Lib "kernel32" () As Long
' Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As Rect) As Long
Declare Function GetFocus Lib "user32" () As Long
Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
#End If
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As String) As Long
Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Const vbd$ = " - Microsoft Visual Basic (design)"
Sub SetParentByCaption(Cap$, NewChild&)
'set parent window
Dim i&
Cap$ = Cap$ & vbd$
i& = FindWindow(0&, Cap$)
If IsWindow(i&) <> 0 Then i& = SetParent(NewChild&, i&)
End Sub
Function GetListItem$(ByVal Source$, ByVal MyItem%, Sep$)
If MyItem% > 0 Then MyItem% = MyItem% - 1
Dim basepos%, thispos%, sepLen%, Cap$, nt%, res$, SourceLen%
basepos% = 1
thispos% = 0
If Left$(Source$, 1) = Sep$ Then Source$ = Mid$(Source$, 2)
SourceLen% = Len(Source$)
sepLen% = Len(Sep$)
If SourceLen% = 0 Then
Cap$ = ""
Else
If Right$(Source$, sepLen%) <> Sep$ Then Source$ = Source$ + Sep$
Do
nt% = InStr(basepos% + 1, Source$, Sep$)
If nt% = 0 Then nt% = SourceLen% + 1
' Now points to next tab or 1 past end of string
If thispos% = MyItem% Then
If nt% - (basepos% - 1) < 0 Then
res$ = ""
Else
res$ = Mid$(Source$, basepos%, nt% - (basepos%))
End If
Exit Do
End If
basepos% = nt% + sepLen%
If nt% <> 1 Then thispos% = thispos% + 1
Loop While basepos% <= SourceLen%
GetListItem$ = res$
End If
End Function
Sub Alert(Mess$)
' * creates an Alert box with an OK button
MsgBox Mess$, 48, App.Title
End Sub
Function exGetName$(myF$)
Dim N%
Do
N% = InStr(myF$, "\")
If N% > 0 Then myF$ = Right$(myF$, Len(myF$) - N%)
Loop While N% > 0
exGetName$ = myF$
End Function
Function ExtractFileExt$(ByVal F$)
Dim i%
i% = InStr(F$, ".")
If i% > 0 And i% < Len(F$) Then
ExtractFileExt$ = Mid$(F$, i% + 1)
Else
ExtractFileExt$ = ""
End If
End Function
Function ExtractFileRoot$(ByVal F$)
' Return the basename portion of a full pathname
Dim N%
F$ = exGetName(F$)
N% = InStr(F$, ".")
If N% > 0 Then ExtractFileRoot$ = Left$(F$, N% - 1)