Hallo,
ich habe heute mal 'ne Function geschrieben die nicht die einfach Dateierweiterung ausgibt sonder wie diese heisst.
Release: 11.12.05
Geschrieben für:
Win32 |
VCL
Unterstützt 27 Dateitypen
Verwendung: einfach die Function in den Code kopieren und bei z.B. Button1Click eingeben:
Label1.Caption:=GetFullExt(<Vollständiger Datiname>);
Wenn Ihr wollt könnt ihr noch Dateien Hinzufügen, aber nicht vergessen auc ganz unteneintragen damit die datei nicht doch als "Unbekannt" abgestempelt wird.
Hier die Function
Delphi-Quellcode:
function GetFullExt(
const FileName:
string):
string;
var
Ext:
string;
begin
Ext:=ExtractFileExt(FileName);
//Pictures
if Ext='
.jpg'
then
Result:='
JPG / JPEG Bild';
if Ext='
.jpeg'
then
Result:='
JPG / JPEG Bild';
if Ext='
.JPG'
then
Result:='
JPG / JPEG Bild';
if Ext='
.JPEG'
then
Result:='
JPG / JPEG Bild';
if Ext='
.ico'
then
Result:='
Windows Symbol';
if Ext='
.bmp'
then
Result:='
Windows Bitmap';
if Ext='
.gif'
then
Result:='
GIF Bild';
if Ext='
.tif'
then
Result:='
Windows Foto Format';
if Ext='
.xcf'
then
Result:='
GIMP Bild';
//Texte
if Ext='
.doc'
then
Result:='
Microsoft Word Dokument';
if Ext='
.xls'
then
Result:='
Microsoft Exel Tabelle';
if Ext='
.txt'
then
Result:='
Textdokument';
if Ext='
.rtf'
then
Result:='
Rich Text Format';
//Source
if Ext='
.pas'
then
Result:='
Delphi Quellcode';
if Ext='
.dfm'
then
Result:='
Delphi Formular Datei';
if Ext='
.dpr'
then
Result:='
Delphi Projekt'
if Ext='
.bdsproj'
then
Result:='
Borland Developer Studio Project File';
if Ext='
.dcu'
then
Result:='
Delphi Compilierte Unit';
if Ext='
.res'
then
Result:='
Ressource Datei';
if Ext='
.cs'
then
Result:='
C# Source File';
if Ext='
.bat'
then
Result:='
Stapelverarbeitungsdatei für MS-DOS';
//Other Files
if Ext='
.exe'
then
Result:='
Ausführbare Datei';
if Ext='
.dll'
then
Result:='
Dynamic Link Library / Programmbibliotek';
if Ext='
.eml'
then
Result:='
Internet E-Mail Nachricht';
if Ext='
.hlp'
then
Result:='
Hilfedatei'
if Ext='
.ini'
then
Result:='
Konfigurations einstellung';
if Ext='
.log'
then
Result:='
"Logbuch"-Datei';
if Ext<>'
.jpg'
then if Ext<>'
.jpeg'
then if Ext<>'
.ico'
then
if Ext<>'
.bmp'
then if Ext<>'
.gif'
then if Ext<>'
tif'
then
if Ext<>'
.JPG'
then if Ext<>'
.JPEG'
then if Ext<>'
.doc'
then
if Ext<>'
.xls'
then if Ext<>'
.txt'
then if Ext<>'
rtf'
then
if Ext<>'
.exe'
then if Ext<>'
.dll'
then if Ext<>'
.pas'
then
if Ext<>'
.dfm'
then if Ext<>'
.dpr'
then if Ext<>'
.bdsproj'
then
if Ext<>'
.dcu'
then if Ext<>'
.res'
then if Ext<>'
.cd'
then
if Ext<>'
.bat'
then if Ext<>'
.xcf'
then if Ext<>'
.eml'
then
if Ext<>'
.hlp'
then if Ext<>'
.ini' the nif Ext<>'
.log'
then
Result:='
unbekannte Dateierweiterung';
end;
Robin W.
Ein Computer kann (fast) alles.... Man muss es ihm nur beibringen