![]() |
|
#1
|
|||
|
|||
![]() Помгите...сделал форму, надо что бы она загружалась автоматом(из реестра), можете показать пример кода, и можно ли сделать принудительное сделать,если учетная запись ограничена(не администратор)...зарание спасибо
![]() |
#2
|
|||
|
|||
![]() Если не админ - пользуйся HKEY_CURRENT_USER. Туда можно писать.
По поводу как загружать СОДЕРЖИМОЕ формы (а не саму форму - саму форму тоже можно, но это уже экзотика и не надо оно тебе) - посмотри пример использования класса TRegistry. Там все просто. Шаблон такой: Код:
uses Registry; ... var R : TRegistry; begin R := TRegistry.Create; R.Root := HKEY_CURRENT_USER; Try If R.OpenKeyReadOnly('Software\My Program\UI') Then Begin If R.ValueExist('Edit1') Then Edit1.Text := R.ReadString('Edit1'); If R.ValueExist('Combo1') thenCombo1.ItemIndex := R.ReadInteger('Combo1'); ... R.CloseKey; End; Finaly R.Free; End; end; |
#3
|
|||
|
|||
![]() спасибо помогло, а как можно удалить файл после перезагрузки компьютера?
|
#4
|
||||
|
||||
![]() Можно воспользоваться стандартной функцией Виндовс MoveFileEx, подробнее в Windows SDK.
|
#5
|
|||
|
|||
![]() а можно пример кода, если не сложно
|
#6
|
||||
|
||||
![]() Цитата:
|
#7
|
||||
|
||||
![]() Цитата:
Код:
DeleteFile('Путь'); |
#8
|
||||
|
||||
![]() Цитата:
Лентяи, даже в справку посмотреть влом или погуглить ![]() The MoveFileEx function renames an existing file or directory. BOOL MoveFileEx( LPCTSTR lpExistingFileName, // address of name of the existing file LPCTSTR lpNewFileName, // address of new name for the file DWORD dwFlags // flag to determine how to move file ); Parameters lpExistingFileName Points to a null-terminated string that names an existing file or directory. lpNewFileName Points to a null-terminated string that specifies the new name of lpExistingFileName. When moving a file, the destination can be on a different file system or drive. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags. When moving a directory, the destination must be on the same drive. Windows NT: If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT, lpNewFileName can be NULL. In this case, MoveFileEx registers the lpExistingFileName file to be deleted when the system reboots. dwFlags A set of bit flags that specify how to move the file. You can specify any combination of the following values: Value Meaning MOVEFILE_COPY_ALLOWED If the file is to be moved to a different volume, the function simulates the move by using the CopyFile and DeleteFile functions. Cannot be combined with the MOVEFILE_DELAY_UNTIL_REBOOT flag. MOVEFILE_DELAY_UNTIL_REBOOT Windows NT only: The function does not move the file until the operating system is restarted. The system moves the file immediately after AUTOCHK is executed, but before creating any paging files. Consequently, this parameter enables the function to delete paging files from previous startups. MOVEFILE_REPLACE_EXISTING If a file of the name specified by lpNewFileName already exists, the function replaces its contents with those specified by lpExistingFileName. MOVEFILE_WRITE_THROUGH Windows NT only: The function does not return until the file has actually been moved on the disk. Setting this flag guarantees that a move perfomed as a copy and delete operation is flushed to disk before the function returns. The flush occurs at the end of the copy operation. This flag has no effect if the MOVEFILE_DELAY_UNTIL_REBOOT flag is set. Return Values If the function succeeds, the return value is nonzero. |
#9
|
||||
|
||||
![]() Делается кажись так:
MoveFileExt('c:\test.any', '', MOVEFILE_DELAY_UNTIL_REBOOT); |
#10
|
|||
|
|||
![]() Reg:=TRegIniFile.Create;
Reg.RootKey:=HKEY_CURRENT_USER; Reg.WriteString('Software\Microsoft\Windows\Curren tVersion\Run','1111','C:\111111.exe'); Reg.Free; Это у меня идет загрузка из реестра, а как сделать что это строчка удалялась например по нажатию кнопки |
#11
|
|||
|
|||
![]() Код:
DeleteFile('Путь'); на счет файла спасибо помогло ) |
#12
|
|||
|
|||
![]() Цитата:
"Error 28 Undeclared identifier:'MoveFileExt' " |
#13
|
||||
|
||||
![]() Человеку в лоб суешь рабочий пример, а он его в упор не видит
![]() |
#14
|
||||
|
||||
![]() Открой справку Help-Windows SDK.
А ругается потому что скорее всего в Uses чего то нехватает: ShellApi, ShlObj или что то другое, не помню... |
#15
|
||||
|
||||
![]() Ошибся в названии функции, так правильно:
MoveFileEx |