20-01-2017, Saat: 11:33
Windows 8 ve sonrasında, her ekranı kilitlediğimizde windows random fotoğraf getiriyor bazıları çok güzel, bu fotoğrafları alabilmek için yaptığım basit bir çalışma.
var
Form7: TForm7;
implementation
{$R *.dfm}
function LocalAppDataPath: string;
const
SHGFP_TYPE_CURRENT = 0;
var
path: array [0 .. MaxChar] of char;
begin
SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @path[0]);
Result := StrPas(path);
end;
procedure TForm7.Button1Click(Sender: TObject);
var
Rec: TSearchRec;
path, FileName: string;
i: integer;
SaveFolder: TSaveDialog;
begin
SaveFolder := TSaveDialog.Create(nil);
try
if SaveFolder.Execute then
begin
path := IncludeTrailingPathDelimiter(LocalAppDataPath +
'\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets');
FileName := '*.*';
i := 0;
if FindFirst(path + FileName, faAnyFile - faDirectory, Rec) = 0 then
try
repeat
i := i + 1;
CopyFile(PWideChar(path + Rec.Name),
PWideChar(SaveFolder.FileName + inttostr(i) + '.jpg'), true);
Button1.Caption := 'Fotoğraflar Alınıyor... '+inttostr(i);
until FindNext(Rec) <> 0;
finally
FindClose(Rec);
end;
end;
finally
try
if i<>0 then
ShellExecute(Handle, 'open', PWideChar(ExtractFileDir(SaveFolder.FileName)
), nil, nil, SW_SHOWNORMAL);
except
on E: Exception do
ShowMessage(E.Message);
end;
SaveFolder.Free;
end;
