if MsgBox('Setup will now connect to Microsoft SQL Server ''' + SQLServerName + ''' via a trusted connection and create a database. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
Exit;
{ Create the main SQLDMO COM Automation object }
try
SQLServer := CreateOleObject('SQLDMO.SQLServer');
except
RaiseException('Please install Microsoft SQL server connectivity tools first.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
end;
{ Connect to the Microsoft SQL Server }
SQLServer.LoginSecure := True;
SQLServer.Connect(SQLServerName);
MsgBox('Connected to Microsoft SQL Server ''' + SQLServerName + '''.', mbInformation, mb_Ok);
if MsgBox('Setup will now connect to Microsoft IIS Server ''' + IISServerName + ''' and create a virtual directory. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
if MsgBox('Setup will now use MSXML to download XML file ''' + XMLURL + ''' and save it to the source folder.'#13#13'Setup will then load, modify and save this XML file. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
MsgBox('Downloaded the XML file and saved it as ''' + XMLFileName + '''.', mbInformation, mb_Ok);
{ Load the XML File }
XMLDoc := CreateOleObject('MSXML2.DOMDocument');
XMLDoc.async := False;
XMLDoc.resolveExternals := False;
XMLDoc.load(Path + XMLFileName);
if XMLDoc.parseError.errorCode <> 0 then
RaiseException('Error on line ' + IntToStr(XMLDoc.parseError.line) + ', position ' + IntToStr(XMLDoc.parseError.linepos) + ': ' + XMLDoc.parseError.reason);
MsgBox('Loaded the XML file.', mbInformation, mb_Ok);
{ Modify the XML document }
NewNode := XMLDoc.createElement('isxdemo');
RootNode := XMLDoc.documentElement;
RootNode.appendChild(NewNode);
RootNode.lastChild.text := 'Hello, World';
{ Save the XML document }
XMLDoc.Save(Path + XMLFileName2);
MsgBox('Saved the modified XML as ''' + XMLFileName2 + '''.', mbInformation, mb_Ok);
end;
{--- Word ---}
procedure WordButtonOnClick(Sender: TObject);
var
Word: Variant;
begin
if MsgBox('Setup will now check whether Microsoft Word is running. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
Exit;
{ Try to get an active Word COM Automation object }
try
Word := GetActiveOleObject('Word.Application');
except
end;
if VarIsEmpty(Word) then
MsgBox('Microsoft Word is not running.', mbInformation, mb_Ok)
else
MsgBox('Microsoft Word is running.', mbInformation, mb_Ok)
end;
{--- Windows Firewall ---}
const
NET_FW_IP_VERSION_ANY = 2;
NET_FW_SCOPE_ALL = 0;
procedure FirewallButtonOnClick(Sender: TObject);
var
Firewall, Application: Variant;
begin
if MsgBox('Setup will now add itself to Windows Firewall as an authorized application for the current profile (' + GetUserNameString + '). Do you want to continue?', mbInformation, mb_YesNo) = idNo then
Exit;
{ Create the main Windows Firewall COM Automation object }
if MsgBox('Setup will now download Zip file ''' + ZipURL + ''' and save it to a temporary folder.'#13#13'Setup will then unzip this Zip file to the source folder. Do you want to continue?', mbInformation, mb_YesNo) = idNo then