Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ShlObj;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- ArquivoTexto: TStringList;
- CaminhoAreaTrabalho: array[0..MAX_PATH] of Char;
- i: Integer;
- begin
- ArquivoTexto := TStringList.Create;
- try
- for i := 1 to 55 do
- begin
- ArquivoTexto.Add('Linha ' + IntToStr(i));
- end;
- if SHGetFolderPath(0, CSIDL_DESKTOP, 0, SHGFP_TYPE_CURRENT, CaminhoAreaTrabalho) = S_OK then
- begin
- ArquivoTexto.SaveToFile(StrPas(CaminhoAreaTrabalho) + '\arquivo.txt');
- end;
- finally
- ArquivoTexto.Free;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement