Global Const FrontPageExplorerID = "FrontPage.Explorer"
Global Const FrontPageEditorID = "FrontPage.Editor"
Global Const FrontPageToDoListID = "FrontPage.ToDoList"
Const FrontPageIniName = "frontpg.ini"
Const FrontPageSection = "FrontPage 3.0"
Const FrontPageRootKey = "FrontPageRoot"
Const FrontPagePWSKey = "PWSRoot"
Const FrontPageHostKey = "CheckedHostName"
' essential dirs in FrontPage installation
Global FrontPageRootDir As String
Global FrontPageDataDir As String
Global FrontPageTempDir As String
Global FrontPageWebsDir As String
Global FrontPagePagesDir As String
' extra stuff for installed Personal Web Server
Global FrontPageServerRoot As String
Global FrontPageServerHost As String
' NOTE: you'll have to do extra work if
' you want to generate absolute URLs;
' you'll have to sift through the [Ports]
' section in frontpg.ini to make sure you
' have the correct port number; this isn't
' necessary for most applications
' command-line info: path to temp file
' holding arguments
Global WizardArgFile As String
' named sections within arg file
Const WizardInputSection = "Input"
Const WizardOutputSection = "Output"
Const WizardEnvironmentSection = "Environment"
' keys for built-in arguments in Input section
Const WizardDirKey = "Dir"
Const WizardInfKey = "Inf"
Const WizardBlockingKey = "Blocking"
Const WizardEditingKey = "Editing"
Const WizardPageURLKey = "PageURL"
Const WizardPageFileKey = "PageFile"
Const WizardPageTitleKey = "PageTitle"
Const WizardDestinationKey = "Destination"
' keys for built-in arguments in Output section
Const WizardExitStatusKey = "ExitStatus"
Const WizardFileCountKey = "FileCount"
' built-in values for exit status key
Global Const WizardStatusOK = "ok"
Global Const WizardStatusCancel = "cancel"
Global Const WizardStatusError = "error"
' data fetched from wizard args file
Global WizardDir As String
Global WizardInf As String
Global WizardBlocking As Boolean
Global WizardEditing As Boolean
Global WizardPageURL As String
Global WizardPageFile As String
Global WizardPageTitle As String
Global WizardDestination As String
' path to wizard settings file (for persistent state);
' this *must* be in the FrontPageData dir, not the
' wizard dir itself; this is so that wizard dirs can
' be shared from a read-only file system
Global WizardIniFile As String
' name of section where all wizard settings are stored
Const WizardSettingsSection = "Settings"
Global WizardHasPreviousSettings As Boolean ' this is true if the file exists
' list of files to be uploaded
Type FileInfo
Name As String ' name of disk file
path As String
IsNew As Integer ' is file being generated by wiz or not?
title As String ' brief description of file
End Type
Global Files() As FileInfo
Global nfiles As Integer
' list of web meta-info variables
Type MetaVar
Name As String
value As String
End Type
Global MetaVars() As MetaVar
Dim nMetaVars As Integer
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 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 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 SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
' declare constants for use with GetWindow
Const GW_HWNDFIRST = 0
Const GW_HWNDLAST = 1
Const GW_HWNDNEXT = 2
Const GW_HWNDPREV = 3
' declare constants for changing window position and Z-order
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Sub CenterFormOnScreen(f As Form)
Dim x As Integer
Dim y As Integer
x = Screen.Width / 2 - f.Width / 2
y = Screen.Height / 2 - f.Height / 2
f.Move x, y
End Sub
Public Function FindWindow(hWndBase As Long, initstr As String) As Long
Dim hWnd As Long
Dim hWndLast As Long
Dim slen As Integer
Dim sbuf As String
' search for a window in the stack where the
' initial chars in its title match 'initstr'
hWnd = GetWindow(hWndBase, GW_HWNDFIRST)
hWndLast = GetWindow(hWndBase, GW_HWNDLAST)
Do
sbuf = String$(255, 0)
slen = GetWindowText(hWnd, sbuf, 255)
sbuf = Left$(sbuf, slen)
If Left$(sbuf, Len(initstr)) = initstr Then
' found
FindWindow = hWnd
Exit Function
End If
hWnd = GetWindow(hWnd, GW_HWNDNEXT)
Loop While hWnd <> hWndLast
' not found
FindWindow = 0
End Function
Public Sub SafeSendKeys(hWnd As Long, keystr As String, Optional sync)
' send a key stream to a given window,
' but first make it the foreground active
' window and lock it at the top of the
' window stack until the stream is finished
If IsMissing(sync) Then sync = False
SetForegroundWindow hWnd
MakeFloatingWindow hWnd, True
SendKeys keystr, sync
MakeFloatingWindow hWnd, False
End Sub
Function GetIniBool(key As String) As Boolean
' wizard-specific routine for reading previous settings
Dim str As String
str = GetIniString(key)
If Len(str) = 0 Then
GetIniBool = False
Else
GetIniBool = CBool(str)
End If
End Function
Function GetIniInt(key As String) As Integer
' wizard-specific routine for reading previous settings
GetIniInt = CInt(GetIniString(key))
End Function
Function GetIniString(key As String) As String
' wizard-specific routine for reading previous settings