Autor Beitrag
florida
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137

Windows 7 Home Premium, Windows XP Professional, Windows 2000
Delphi 2010 Architect
BeitragVerfasst: Do 06.08.09 10:33 
ausblenden Delphi-Quelltext
1:
  CopyFile(PChar(ShortCutDialog.FileName), PChar(ExtractFilePath(Application.ExeName)) + 'Programme\', True);					


Wieso funktioniert das nicht?


Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am Do 06.08.2009 um 10:42
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10184
Erhaltene Danke: 1259

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 06.08.09 10:42 
Moin!

user profile iconflorida hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
CopyFile(PChar(ShortCutDialog.FileName), PChar(ExtractFilePath(Application.ExeName)) + 'Programme\', True);					

Wieso funktioniert das nicht?
Was ist der Fehler?

Was wird hier ausgegeben?
ausblenden Delphi-Quelltext
1:
2:
ShowMessage(ShortCutDialog.FileName);
ShowMessage(ExtractFilePath(Application.ExeName) + 'Programme\');


Du gibst keinen Zieldateinamen an, das sollte aber laut Doku so sein:
Zitat:
The CopyFile function copies an existing file to a new file.

BOOL CopyFile(

LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);


Parameters

lpExistingFileName

Points to a null-terminated string that specifies the name of an existing file.

lpNewFileName

Points to a null-terminated string that specifies the name of the new file.

bFailIfExists

Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file 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 Values

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.

Remarks

Security attributes for the existing file are not copied to the new file.
File attributes (FILE_ATTRIBUTE_*) for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For further information on file attributes, see CreateFile.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.