REM Description: Install WSWin registration database keys
REM Filename: wswregdb.wmc
REM Created by: Rich Zuris - 2/2/94
CONST MAXKEY% = 4 'Number of file types to register
DIM Description$(MAXKEY%), Extension$(MAXKEY%), Key$(MAXKEY%), Open$(MAXKEY%), Print$(MAXKEY%)
i% = 1
Description$(i%) = "WordStar for Windows Document"
Extension$(i%) = ".wsd"
Key$(i%) = "wswdoc"
Open$(i%) = "wswin.exe %1"
Print$(i%) = "wswin.exe %1 /p"
i% = 2
Description$(i%) = "WordStar for Windows Template"
Extension$(i%) = ".wst"
Key$(i%) = "wswtmplt"
Open$(i%) = "wswin.exe %1 /n"
Print$(i%) = "wswin.exe %1 /p"
i% = 3
Description$(i%) = "WordStar for Windows Macro"
Extension$(i%) = ".wmc"
Key$(i%) = "wswmac"
Open$(i%) = "wsmaced.exe %1"
Print$(i%) = ""
i% = 4
Description$(i%) = "WordStar for Windows Macro Dialog"
Extension$(i%) = ".wdg"
Key$(i%) = "wswdlg"
Open$(i%) = "wsdlged.exe %1"
Print$(i%) = ""
SHARED Directory$ 'WSWin application directory
SHARED Value$ 'Reg key value
CONST regOpen$ = "\shell\open\command"
CONST regPrint$ = "\shell\print\command"
CONST WininiExt$ = "Extensions"
'Windows APIs
DECLARE FUNCTION RegSetValue LIB "shell.dll" (hkey AS INTEGER, subkey AS STRING, keytype AS INTEGER, value AS STRING, size AS INTEGER) AS INTEGER
DECLARE FUNCTION GetPrivateProfileString LIB "kernel" (lpApplicationName AS STRING, lpKeyName AS STRING, lpDefault AS STRING, lpReturnedString AS STRING, nSize As WORD, lpFileName AS STRING) AS WORD
DECLARE FUNCTION WriteProfileString LIB "kernel" (lpApplicationName AS STRING, lpKeyName AS STRING, value AS INTEGER) As WORD
DECLARE FUNCTION GetModuleHandle LIB "kernel" (lpApp AS STRING) AS WORD
DECLARE FUNCTION GetModuleFileName LIB "kernel" (hinst AS WORD, app AS STRING, size AS WORD) AS WORD
DECLARE FUNCTION MessageBox LIB "user" (hwnd AS WORD, lpMsg AS STRING, lpTitle AS STRING, wFlags AS WORD) AS WORD
hinst% = GetModuleHandle("WSWINDLL")
IF hinst% <> 0 THEN 'If WSWin is active, show status and get directory name
Msg$ = "Choose OK to update the registration database, or choose Cancel to quit."
Msg$ = Msg$ + CHR$(13) + CHR$(13) + "The registration database contains information "
Msg$ = Msg$ + "necessary for OLE and Drag and Drop."
IF MessageBox(I2W(0), Msg$, "WSWin Macro", I2W(33)) = 2 THEN STOP
StatusMsg "Registering WSWin files in registration database . . ."