
12.12.2013, 18:27
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Цитата:
Сообщение от Slackerok
Для моих знаний моя цель сложновата
|
ну для изучения можно было попроще задание выбрать
Код:
uses
ShellAPI, ShlObj, ActiveX,
...
function GetSpecialFolderLocation(Folder: Integer): String;
var
ppidl: PItemIDList;
begin
Result:='';
ppidl:=nil;
try
if SHGetSpecialFolderLocation(0, Folder, ppidl)=S_OK then
begin
SetLength(Result, MAX_PATH);
if SHGetPathFromIDList(ppidl, PChar(Result)) then
Result:=IncludeTrailingPathDelimiter(PChar(Result))
else
Result:='';
end;
finally
if ppidl<>nil then CoTaskMemFree(ppidl);
end;
end;
var
Buffer: array [0..MAX_PATH] of Char;
Len: Integer;
DesktopDir: String;
WindowsDirectory: String;
begin
DesktopDir:=GetSpecialFolderLocation(CSIDL_DESKTOPDIRECTORY);
Len:=GetWindowsDirectory(@Buffer[0], MAX_PATH);
WindowsDirectory:=IncludeTrailingPathDelimiter(Copy(Buffer, 1, Len));
CopyFile(PChar(WindowsDirectory+'System32\taskmgr.exe'),
PChar(DesktopDir+'taskmgr.exe'), False);
end;
__________________
Пишу программы за еду.
__________________
|