Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 781 to 795 of 888, page 53 of 60
<< previous next >>



Compressing files
- 1) Fill the CABFileContents collection with CABFileEntry elements, where Name is the full path to the file that needs to be added to the CAB file. Set the relative path for decompressing in the RelPath property
- 2) Set the CABFile property to the CAB file that needs to be created Note that the CAB API doesn't allow to add files to an existing CAB file, so you must choose a non-existing file!
- 3) Call the Compress method



Decompressing files
- 1) Set the property CABFile to the full path + filename of the CAB file
- 2) Call the method GetContents. This method fills the collection with details about the files included in the CAB file
- 3) Call either ExtractAll, ExtractSelected, ExtractFile(filename:string) The first method extracts all files to the TargetPath, regardless of the Selected state in each CABFileEntry in the CABFileContents collection
ExtractFile extracts only one file, regardless of its Selected state



Using TMacroRecorder
Start recording:
procedure TForm1.StartRecording; begin MacroRecorder1.FileName := 'c:\test\mymacro.mac'; MacroRecorder1.RecordMacro; end;
Stop recording:
procedure TForm1.StopRecording; begin MacroRecorder1.StopRecording; end;
Playback recorded macro:
procedure TForm1.PlayMacro; begin MacroRecorder1.FileName := 'c:\test\mymacro.mac'; MacroRecorder1.PlayMacro; end;



Getting Started
TXAMLViewer
Drop TXamlViewer instance on the form and set the XAML code with XamlViewer.XAMLText: widestring property.
Example:
XamlViewer.XAMLText := '';
XAMLViewer1.LastError: widestring
TXPSViewer
Drop TXPSViewer instance on the form and set the filename of the XPS file to view with
XPSViewer.Filename



Using TWebUpdate with C++Builder
For C++Builder users, add following line in your app's main CPP file:
#pragma link "wininet.lib"



General tips
- When the update download is downloaded on the desktop or other folder than the folder where the application's EXE is located, make sure to use SetCurrentDir(ExtractFilePath(Application.ExeName)); before calling TWebUpdate.DoUpdate
- When the updated EXE is distributed as CAB file, make sure that TWebUpdate.CABExtract is set to false and that there are no identifiers compressed = 1 in the section for the application. It is the spawned updater app that needs to decompress the CAB file and not TWebUpdate in the application itself.



C++Builder
For C++Builder users, add following line in your app's main CPP file:
#pragma link "wininet.lib"



C++Builder
For C++Builder users, add following line in your app's main CPP file:
#pragma link "wininet.lib"



Setting a Unicode text as form caption
First of all, in the form declaration, change the class TForm your form inherits from to TTntForm, ie:
TMyForm = class(TForm) // change to: TMyForm = class(TTntForm)
and make sure that in your system display settings, the Window caption font is a full unicode supporting font.



Unicode hints
The Tnt Unicode components have a full widestring Hint property with which a unicode hint text can be set. To make sure the hint is shown with Unicode displayed, set the application hint window class as TntHintWindow, ie:
HintWindowClass := TntHintWindow; // If the system hint font does not support unicode, you can override this by creating a class: TTntHintWindowEx = class(TTntHintwindow) protected procedure CreateWindowHandle(const Params: TCreateParams); override; end; { TTntHintWindowEx } procedure TTntHintWindowEx.CreateWindowHandle(const Params: TCreateParams); begin inherited; Canvas.Font.Name := 'Arial Unicode MS'; end; // and set: HintWindowClass := TntHintWindowEx;



HTTP:
Files to copy over the web can be easily set at design time using a Items collection or programmatically :
with WebCopy.Items.Add do begin URL := 'https://www.tmssoftware.com/webcopy.zip'; Protocol := wpHTTP; FileDate := EncodeDate(2002,3,18); CopyNewerOnly := true; TargetDir := 'c:\temp'; end; WebCopy.Execute;



HTTP upload:
with WebCopy.Items.Add do begin URL := 'http://www.myserver.com/uploadscript.asp'; Protocol := wpHTTPUpload; TargetDir := 'c:\temp'; TargetFileName := 'myfile.txt'; end; WebCopy.Execute;



Network file copy:
with WebCopy.Items.Add do begin URL := '\\machine\dir\webcopy.zip'; Protocol := wpFile; FileDate := EncodeDate(2002,3,18); CopyNewerOnly := true; TargetDir := 'c:\temp'; end; WebCopy.Execute;



Multi file upload via FTP:
WebCopy.Items.Clear; with WebCopy.Items.Add do begin Protocol := wpMultiFtpUpload; URL := 'c:\directory\myfiles\*.txt'; FTPHost := ftp.myserver.com; FTPUserID := myuserid; FTPPassword := mypassword; TargetDir := ftpserverdir; end; WebCopy.Execute;



Multi file download via FTP:
WebCopy.Items.Clear; with WebCopy.Items.Add do begin Protocol := wpMultiFtp; URL := 'ftpdirectory\*.txt'; FTPHost := ftp.myserver.com; FTPUserID := myuserid; FTPPassword := mypassword; TargetDir := 'c:\localdir\ftpdownload'; end; WebCopy.Execute;