Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Delphi программирование > Общие вопросы Delphi
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 13.02.2008, 23:06   #1
Rahim1993
Пользователь
 
Аватар для Rahim1993
 
Регистрация: 27.12.2007
Сообщений: 67
По умолчанию Копирование программы.

Как сделать так, чтобы моя программа при запуске автоматически копировалась в папку Windows?

CopyFile()
И вовсе не обязательно писать столько знаков вопроса.
S.R.H.(Rahim)

Последний раз редактировалось Квэнди; 13.02.2008 в 23:48.
Rahim1993 вне форума Ответить с цитированием
Старый 13.02.2008, 23:51   #2
Квэнди
Старожил
 
Аватар для Квэнди
 
Регистрация: 13.12.2006
Сообщений: 3,859
По умолчанию

Нажимаем F1 , ищем там copyfile и что же мы видим ?
CopyFile

The CopyFile function copies an existing file to a new file.

The CopyFileEx function provides two additional capabilities. CopyFileEx can call a specified callback function each time a portion of the copy operation is completed, and CopyFileEx can be canceled during the copy operation.


BOOL CopyFile(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
BOOL bFailIfExists
);

Parameters
lpExistingFileName
[in] Pointer to a null-terminated string that specifies the name of an existing file.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

Windows Me/98/95: This string must not exceed MAX_PATH characters.
If lpExistingFileName does not exist, CopyFile fails, and GetLastError returns ERROR_FILE_NOT_FOUND.

lpNewFileName
[in] Pointer to a null-terminated string that specifies the name of the new file.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

Windows Me/98/95: This string must not exceed MAX_PATH characters.
bFailIfExists
[in] If this parameter is TRUE and the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
Return Value
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

А если обощить:
Copyfile (что,куда, перезаписывать ?);
ICQ не для вопросов, а для предложений. Для вопросов используйте форум
IRC канал клуба программистов|Мои статьи
Квэнди вне форума Ответить с цитированием
Старый 13.02.2008, 23:57   #3
Terran
Участник клуба
 
Аватар для Terran
 
Регистрация: 28.11.2007
Сообщений: 1,521
По умолчанию

CopyFile(PChar(ParamStr(0)), PChar('Новый_путь' +
ExtractFileName(ParamStr(0))), True);
Всегда рад помочь!
Terran вне форума Ответить с цитированием
Старый 14.02.2008, 00:03   #4
mihali4
*
Старожил
 
Регистрация: 22.11.2006
Сообщений: 9,201
По умолчанию

Это совсем "небольно" :
Код:
procedure TForm1.FormCreate(Sender: TObject);
var windir: Array[0..MAX_PATH] of char;
begin
GetWindowsDirectory(windir, sizeof(windir));
CopyFile(PChar(Application.ExeName),
PChar(StrPas(windir)+'\'+ExtractFileName(Application.ExeName)), true);
end;
mihali4 вне форума Ответить с цитированием
Старый 14.02.2008, 11:44   #5
Rahim1993
Пользователь
 
Аватар для Rahim1993
 
Регистрация: 27.12.2007
Сообщений: 67
По умолчанию

Terran, Mihali4, большое вам спасибо!
S.R.H.(Rahim)
Rahim1993 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Копирование *.exe вручную v01umE Общие вопросы C/C++ 4 06.07.2008 20:06
Копирование ryton SQL, базы данных 2 30.06.2008 09:32
Запуск программы на выполнение из другой программы. ViNcHeStEr Паскаль, Turbo Pascal, PascalABC.NET 6 18.06.2008 14:33
Копирование и запуск RealSHELS Общие вопросы Delphi 2 27.03.2008 22:03
Копирование информации JoJo Общие вопросы Delphi 7 23.11.2007 12:15