Programlama yapalım ve Öğrenelim. - Delphi Eğitim182
  Ana Sayfa
  .NET Eğitim Notları
  Visual C# .NET Örnek Kodları
  VisualBasic.NET Örnek Kodları
  J# Örnekleri
  ASP.NET Örnek Kodları
  Delphi Eğitim
  => Delphi Eğitim1
  => Delphi Eğitim2
  => Delphi Eğitim3
  => Delphi Eğitim4
  => Delphi Eğitim5
  => Delphi Eğitim6
  => Delphi Eğitim7
  => Delphi Eğitim8
  => Delphi Eğitim9
  => Delphi Eğitim10
  => Delphi Eğitim11
  => Delphi Eğitim13
  => Delphi Eğitim14
  => Delphi Eğitim15
  => Delphi Eğitim16
  => Delphi Eğitim17
  => Delphi Eğitim18
  => Delphi Eğitim19
  => Delphi Eğitim20
  => Delphi Eğitim21
  => Delphi Eğitim22
  => Delphi Eğitim23
  => Delphi Eğitim24
  => Delphi Eğitim25
  => Delphi Eğitim26
  => Delphi Eğitim27
  => Delphi Eğitim28
  => Delphi Eğitim29
  => Delphi Eğitim30
  => Delphi Eğtim31
  => Delphi Eğitim32
  => Delphi Eğitim33
  => Delphi Eğitim34
  => Delphi Eğitim35
  => Delphi Eğitim36
  => Delphi Eğitim37
  => Delphi Eğitim38
  => Delphi Eğitim39
  => Delphi Eğitim40
  => Delphi Eğitim41
  => Delphi Eğitim42
  => Delphi Eğitim43
  => Delphi Eğitim44
  => Delphi Eğitim45
  => Delphi Eğitim46
  => Delphi Eğitim47
  => Delphi Eğitim48
  => Delphi Eğitim49
  => Delphi Eğitim50
  => Delphi Eğitim51
  => Delphi Eğitim52
  => Delphi Eğitim53
  => Delphi Eğitim54
  => Delphi Eğitim55
  => Delphi Eğitim56
  => Delphi Eğitim57
  => Delphi Eğitim58
  => Delphi Eğitim59
  => Delphi Eğitim60
  => Delphi Eğitim61
  => Delphi Eğitim62
  => Delphi Eğitim63
  => Delphi Eğitim64
  => Delphi Eğitim65
  => Delphi Eğitim66
  => Delphi Eğitim67
  => Delphi Eğitim68
  => Delphi Eğitim69
  => Delphi Eğitim70
  => Delphi Eğitim71
  => Delphi Eğitim72
  => Delphi Eğitim73
  => Delphi Eğitim74
  => Delphi Eğitim75
  => Delphi Eğitim76
  => Delphi Eğitim77
  => Delphi Eğitim78
  => Delphi Eğitim79
  => Delphi Eğitim80
  => Delphi Eğitim81
  => Delphi Eğitim82
  => Delphi Eğitim83
  => Delphi Eğitim84
  => Delphi Eğitim85
  => Delphi Eğitim86
  => Delphi Eğitim87
  => Delphi Eğitim88
  => Delphi Eğitim89
  => Delphi Eğitim90
  => Delphi Eğitim91
  => Delphi Eğitim92
  => Delphi Eğitim93
  => Delphi Eğitim94
  => Delphi Eğitim95
  => Delphi Eğitim96
  => Delphi Eğitim97
  => Delphi Eğitim98
  => Delphi Eğitim99
  => Delphi Eğitim100
  => Delphi Eğitim101
  => Delphi Eğitim102
  => Delphi Eğitim103
  => Delphi Eğitim104
  => Delphi Eğitim105
  => Delphi Eğitim106
  => Delphi Eğitim107
  => Delphi Eğitim108
  => Delphi Eğitim109
  => Delphi Eğitim110
  => Delphi Eğitim111
  => Delphi Eğitim112
  => Delphi Eğitim113
  => Delphi Eğitim114
  => Delphi Eğitim115
  => Delphi Eğitim116
  => Delphi Eğitim117
  => Delphi Eğitim118
  => Delphi Eğitim119
  => Delphi Eğitim120
  => Delphi Eğitim121
  => Delphi Eğitim122
  => Delphi Eğitim123
  => Delphi Eğitim124
  => Delphi Eğitim125
  => Delphi Eğitim126
  => Delphi Eğitim127
  => Delphi Eğitim128
  => Delphi Eğitim129
  => Delphi Eğitim130
  => Delphi Eğitim131
  => Delphi Eğitim132
  => Delphi Eğitim133
  => Delphi Eğitim134
  => Delphi Eğitim135
  => Delphi Eğitim136
  => Delphi Eğitim137
  => Delphi Eğitim138
  => Delphi Eğitim139
  => Delphi Eğitim140
  => Delphi Eğitim141
  => Delphi Eğitim142
  => Delphi Eğitim143
  => Delphi Eğitim144
  => Delphi Eğitim145
  => Delphi Eğitim146
  => Delphi eğitim147
  => Delphi Eğitim148
  => Delphi Eğitim149
  => Delphi Eğitim150
  => Delphi Eğitim151
  => Delphi Eğitim152
  => Delphi Eğitim153
  => Delphi Eğitim154
  => Delphi Eğitim155
  => Delphi Eğitim156
  => Delphi Eğitim157
  => Delphi Eğitim158
  => Delphi Eğitim159
  => Delphi Eğitim160
  => Delphi Eğitim161
  => Delphi Eğitim162
  => Delphi Eğitim164
  => Delphi Eğitim165
  => Delphi Eğitim166
  => Delphi Eğitim167
  => Delphi Eğitim168
  => Delphi Eğitim169
  => Delphi Eğitim170
  => Delphi Eğitim171
  => Delphi Eğitim172
  => Delphi Eğitim173
  => Delphi Eğitim174
  => Delphi Eğitim175
  => Delphi Eğitim176
  => Delphi Eğitim177
  => Delphi Eğitim178
  => Delphi Eğitim179
  => Delphi Eğitim180
  => Delphi Eğitim181
  => Delphi Eğitim182
  => Delphi Eğitim183
  => Delphi Eğitim184
  => Delphi Eğitim185
  => Delphi Eğitim186
  => Delphi Eğitim187
  => Delphi Eğitim188
  => Delphi Eğitim189
  => Delphi Eğitim190
  => Delphi Eğitim191
  => Delphi Eğitim192
  => Delphi Eğitim193
  => Delphi Eğitim194
  => Delphi Eğitim195
  => Delphi Eğitim196
  => Delphi Eğitim197
  => Delphi Eğitim198
  => Delphi Eğitim199
  => Delphi Eğitim200
  => Delphi Eğitim201
  => Delphi Eğitim202
  => Delphi Eğitim203
  => Delphi Eğitim204
  => Delphi Eğitim205
  => Delphi Eğitim206
  => Delphi Eğitim207
  => Delphi Eğitim208
  => Delphi Eğitim209
  => Delphi Eğitim210
  => Delphi Eğitim211
  => Delphi Eğitim212
  => Delphi Eğitim213
  => Delphi Eğitim214
  => Delphi Eğitim215
  => Delphi Eğitim216
  => Delphi Eğitim217
  => Delphi Eğitim218
  => Delphi Eğitim219
  => Delphi Eğitim220
  => Delphi Eğitim221
  => Delphi Eğitim222
  => Delphi Eğitim223
  => Delphi Eğitim224
  => Delphi Eğitim225
  => Delphi Eğitim226
  => Delphi Eğitim227
  => Delphi Eğitim228
  => Delphi Eğitim229
  => Delphi Eğitim230
  => Delphi Eğitim231
  => Delphi Eğitim232
  => Delphi Eğitim233
  => Delphi Eğitim234
  => Delphi Eğitim235
  => Delphi Eğitim236
  => Delphi Eğitim237
  => Delphi Eğitim238
  => Delphi Eğitim239
  => Delphi Eğitim240
  => Delphi Eğitim241
  => Delphi Eğitim242
  İletişim

neoturk: ...Load the cd-rom icon ?...

function GetCDIcon(Drive: Char): TIcon;

var

  ico: TIcon;

  ini: TIniFile;

  s, p: string;

  i, j: Integer;

begin

  //Abbrechen wenn "AutoRun.Inf" nicht existiert.

  //Abort if "AutoRun.inf" doesn't exists.

  if FileExists(Drive + ':autorun.inf') = False then Exit;

 

  //"AutoRun.inf" öffnen

  //Opens the "AutoRun.inf"

  ini := TIniFile.Create(Drive + ':autorun.inf');

  ico := TIcon.Create;

 

  try

    //Dateinamen lesen

    //Read the filename

    s := ini.ReadString('Autorun', 'ICON', '');

 

    //Abbrechen, wenn kein Icon festgelegt wurde

    //Abort if there is no icon specified

    if s = '' then Exit;

 

    //Icon von Datei laden

    //load the icon from a file

    if FileExists(s) then ico.LoadFromFile(s);

    if FileExists(Drive + ':' + s) then ico.LoadFromFile(Drive + ':' + s);

 

    //Icon aus einer Resource laden

    //Load the icon from a Win32 resource

    if (FileExists(s) = False) and (FileExists(Drive + ':' + s) = False) then

    begin

      for j := (Pos(',', s) + 1) to Length(s) do

      begin

        p := p + s[j];

      end;

      i := StrToInt(p);

      for j := Length(s) downto (Pos(',', s)) do

        Delete(s, j, Length(s));

 

      if FileExists(s) = False then s := Drive + ':' + s;

 

      ico.Handle := ExtractIcon(hinstance, PChar(s), i);

    end;

 

    Result := ico;

  finally

    ini.Free;

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Load the cd-rom icon ?...

function GetCDIcon(Drive: Char): TIcon;

var

  ico: TIcon;

  ini: TIniFile;

  s, p: string;

  i, j: Integer;

begin

  //Abbrechen wenn "AutoRun.Inf" nicht existiert.

  //Abort if "AutoRun.inf" doesn't exists.

  if FileExists(Drive + ':autorun.inf') = False then Exit;

 

  //"AutoRun.inf" öffnen

  //Opens the "AutoRun.inf"

  ini := TIniFile.Create(Drive + ':autorun.inf');

  ico := TIcon.Create;

 

  try

    //Dateinamen lesen

    //Read the filename

    s := ini.ReadString('Autorun', 'ICON', '');

 

    //Abbrechen, wenn kein Icon festgelegt wurde

    //Abort if there is no icon specified

    if s = '' then Exit;

 

    //Icon von Datei laden

    //load the icon from a file

    if FileExists(s) then ico.LoadFromFile(s);

    if FileExists(Drive + ':' + s) then ico.LoadFromFile(Drive + ':' + s);

 

    //Icon aus einer Resource laden

    //Load the icon from a Win32 resource

    if (FileExists(s) = False) and (FileExists(Drive + ':' + s) = False) then

    begin

      for j := (Pos(',', s) + 1) to Length(s) do

      begin

        p := p + s[j];

      end;

      i := StrToInt(p);

      for j := Length(s) downto (Pos(',', s)) do

        Delete(s, j, Length(s));

 

      if FileExists(s) = False then s := Drive + ':' + s;

 

      ico.Handle := ExtractIcon(hinstance, PChar(s), i);

    end;

 

    Result := ico;

  finally

    ini.Free;

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Encrypt-decrypt files with windows ntfs functions ?...

{....}

 

{

Dieser Tip funktioniert ab Windows 2000 (NTFS 5)

 

Diese 2 Funktionen sind in windows.pas definiert, jedoch sind sie dort

falsch definiert. Deshalb hier die eigene Definition.

}

 

 

{

This tip works with Windows 2000 (NTFS 5) and later

 

These 2 functions are defined in windows.pas, but they're defined wrong. In this

case our own definition.

}

 

  function EncryptFile(lpFilename: PChar): BOOL; stdcall;

           external advapi32 name 'EncryptFileA';

 

  function DecryptFile(lpFilename: PChar; dwReserved: DWORD): BOOL; stdcall;

           external advapi32 name 'DecryptFileA';

 

 

{....}

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if not EncryptFile('c:temp') then

    ShowMessage('Can''t encrypt directory.');

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

  if not DecryptFile('c:temp', 0) then

    ShowMessage('Can''t decrypt directory.');

end;

 

Delphi - .....................................

 

neoturk: ...Encrypt-decrypt files with windows ntfs functions ?...

{....}

 

{

Dieser Tip funktioniert ab Windows 2000 (NTFS 5)

 

Diese 2 Funktionen sind in windows.pas definiert, jedoch sind sie dort

falsch definiert. Deshalb hier die eigene Definition.

}

 

 

{

This tip works with Windows 2000 (NTFS 5) and later

 

These 2 functions are defined in windows.pas, but they're defined wrong. In this

case our own definition.

}

 

  function EncryptFile(lpFilename: PChar): BOOL; stdcall;

           external advapi32 name 'EncryptFileA';

 

  function DecryptFile(lpFilename: PChar; dwReserved: DWORD): BOOL; stdcall;

           external advapi32 name 'DecryptFileA';

 

 

{....}

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if not EncryptFile('c:temp') then

    ShowMessage('Can''t encrypt directory.');

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

  if not DecryptFile('c:temp', 0) then

    ShowMessage('Can''t decrypt directory.');

end;

 

Delphi - .....................................

 

neoturk: ...Send data to another program by auto-drag-drop ?...

uses

  ShellAPI;

 

function MakeDrop(const FileNames: array of string): THandle;

// Creates a hDrop Object

// erzeugt ein hDrop Object

var

  I, Size: Integer;

  Data: PDragInfoA;

  P: PChar;

begin

  // Calculate memory size needed

  // berechne notwendig Speichergröße

  Size := SizeOf(TDragInfoA) + 1;

  for I := 0 to High(FileNames) do

    Inc(Size, Length(FileNames[I]) + 1);

  // allocate the memory

  // alloziere den speicher

  Result := GlobalAlloc(GHND or GMEM_SHARE, Size);

  if Result <> 0 then

  begin

    Data := GlobalLock(Result);

    if Data <> nil then

      try

        // fill up with data

        // fülle daten

        Data.uSize := SizeOf(TDragInfoA);

        P  := PChar(@Data.grfKeyState) + 4;

        Data.lpFileList := P;

        // filenames at the at of the header (separated with #0)

        // am ende des headers nun die filenamen getrennt mit #0

        for I := 0 to High(FileNames) do

        begin

          Size := Length(FileNames[I]);

          Move(Pointer(FileNames[I])^, P^, Size);

          Inc(P, Size + 1);

        end;

      finally

        GlobalUnlock(Result);

      end

    else

    begin

      GlobalFree(Result);

      Result := 0;

    end;

  end;

end;

 

function MyEnum(Wnd: hWnd; Res: PInteger): Bool; stdcall;

// search for a edit control with classname 'TEditControl'

// suche ein child fenster mit klassennamen 'TEditControl'

var

  N: string;

begin

  SetLength(N, MAX_PATH);

  SetLength(N, GetClassName(Wnd, Pointer(N), Length(N)));

  Result := AnsiCompareText('TEditControl', N) <> 0;

  if not Result then Res^ := Wnd;

end;

 

// Example: Open msdos.sys in Delphi's Editor window

// Beispiel: msdos.sys im Delphi Editor öffnen

procedure TForm1.Button1Click(Sender: TObject);

var

  Wnd: HWnd;

  Drop: hDrop;

begin

  // search for Delphi's Editor

  // suche Delphis Editor Fenster

  EnumChildWindows(FindWindow('TEditWindow', nil), @MyEnum, Integer(@Wnd));

  if IsWindow(Wnd) then

  begin

    // Delphi's Editor found. Open msdos.sys

    // Delphis editor gefunden, also öffne msdos.sys

    Drop := MakeDrop(['c:msdos.sys']);

    if Drop <> 0 then PostMessage(Wnd, wm_DropFiles, Drop, 0);

    // Free the memory?

    // Speicher wieder freigeben?

    GlobalFree(Drop);

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Send data to another program by auto-drag-drop ?...

uses

  ShellAPI;

 

function MakeDrop(const FileNames: array of string): THandle;

// Creates a hDrop Object

// erzeugt ein hDrop Object

var

  I, Size: Integer;

  Data: PDragInfoA;

  P: PChar;

begin

  // Calculate memory size needed

  // berechne notwendig Speichergröße

  Size := SizeOf(TDragInfoA) + 1;

  for I := 0 to High(FileNames) do

    Inc(Size, Length(FileNames[I]) + 1);

  // allocate the memory

  // alloziere den speicher

  Result := GlobalAlloc(GHND or GMEM_SHARE, Size);

  if Result <> 0 then

  begin

    Data := GlobalLock(Result);

    if Data <> nil then

      try

        // fill up with data

        // fülle daten

        Data.uSize := SizeOf(TDragInfoA);

        P  := PChar(@Data.grfKeyState) + 4;

        Data.lpFileList := P;

        // filenames at the at of the header (separated with #0)

        // am ende des headers nun die filenamen getrennt mit #0

        for I := 0 to High(FileNames) do

        begin

          Size := Length(FileNames[I]);

          Move(Pointer(FileNames[I])^, P^, Size);

          Inc(P, Size + 1);

        end;

      finally

        GlobalUnlock(Result);

      end

    else

    begin

      GlobalFree(Result);

      Result := 0;

    end;

  end;

end;

 

function MyEnum(Wnd: hWnd; Res: PInteger): Bool; stdcall;

// search for a edit control with classname 'TEditControl'

// suche ein child fenster mit klassennamen 'TEditControl'

var

  N: string;

begin

  SetLength(N, MAX_PATH);

  SetLength(N, GetClassName(Wnd, Pointer(N), Length(N)));

  Result := AnsiCompareText('TEditControl', N) <> 0;

  if not Result then Res^ := Wnd;

end;

 

// Example: Open msdos.sys in Delphi's Editor window

// Beispiel: msdos.sys im Delphi Editor öffnen

procedure TForm1.Button1Click(Sender: TObject);

var

  Wnd: HWnd;

  Drop: hDrop;

begin

  // search for Delphi's Editor

  // suche Delphis Editor Fenster

  EnumChildWindows(FindWindow('TEditWindow', nil), @MyEnum, Integer(@Wnd));

  if IsWindow(Wnd) then

  begin

    // Delphi's Editor found. Open msdos.sys

    // Delphis editor gefunden, also öffne msdos.sys

    Drop := MakeDrop(['c:msdos.sys']);

    if Drop <> 0 then PostMessage(Wnd, wm_DropFiles, Drop, 0);

    // Free the memory?

    // Speicher wieder freigeben?

    GlobalFree(Drop);

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Execute a document and wait for it to finish ?...

{

  This tip allows you to open any document with its

  associated application (not only exe, com) and wait for it to finish.

}

 

 

{

  Dieser Tip ermöglicht es, nicht nur normale Programme, sondern auch Dateien,

  die mit Programmen geöffnet werden, auszuführen und darauf zu warten,

  bis sie beendet sind.

}

 

uses

  Shellapi;

 

function StartAssociatedExe(FileName: string; var ErrorCode: Cardinal): Boolean;

var

  Prg: string;

  ProcessInfo: TProcessInformation;

  StartupInfo: TStartupInfo;

begin

  SetLength(Prg, MAX_PATH);

  Result := False;

  ErrorCode := FindExecutable(PChar(FileName), nil, PChar(Prg));

  if ErrorCode >= 32 then

  begin

    SetLength(Prg, StrLen(PChar(Prg)));

    FillChar(StartupInfo, SizeOf(TStartupInfo), 0);

    with StartupInfo do

    begin

      cb := SizeOf(TStartupInfo);

      wShowWindow := SW_SHOW;

    end;

    if CreateProcess(PChar(Prg), PChar(Format('%s %s', [Prg, FileName])),

      nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then

    begin

      WaitForSingleObject(ProcessInfo.hProcess, INFINITE);

      GetExitCodeProcess(ProcessInfo.hProcess, ErrorCode);

      CloseHandle(ProcessInfo.hProcess);

      CloseHandle(ProcessInfo.hThread);

      Result := True;

    end

    else

      ErrorCode := GetLastError;

  end;

end;

 

// Example, Beispiel:

 

procedure TForm1.Button1Click(Sender: TObject);

var

  ErrorCode: Cardinal;

begin

  StartAssociatedExe('c:test.doc', ErrorCode);

end;

 

Delphi - .....................................

 

neoturk: ...Execute a document and wait for it to finish ?...

{

  This tip allows you to open any document with its

  associated application (not only exe, com) and wait for it to finish.

}

 

 

{

  Dieser Tip ermöglicht es, nicht nur normale Programme, sondern auch Dateien,

  die mit Programmen geöffnet werden, auszuführen und darauf zu warten,

  bis sie beendet sind.

}

 

uses

  Shellapi;

 

function StartAssociatedExe(FileName: string; var ErrorCode: Cardinal): Boolean;

var

  Prg: string;

  ProcessInfo: TProcessInformation;

  StartupInfo: TStartupInfo;

begin

  SetLength(Prg, MAX_PATH);

  Result := False;

  ErrorCode := FindExecutable(PChar(FileName), nil, PChar(Prg));

  if ErrorCode >= 32 then

  begin

    SetLength(Prg, StrLen(PChar(Prg)));

    FillChar(StartupInfo, SizeOf(TStartupInfo), 0);

    with StartupInfo do

    begin

      cb := SizeOf(TStartupInfo);

      wShowWindow := SW_SHOW;

    end;

    if CreateProcess(PChar(Prg), PChar(Format('%s %s', [Prg, FileName])),

      nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then

    begin

      WaitForSingleObject(ProcessInfo.hProcess, INFINITE);

      GetExitCodeProcess(ProcessInfo.hProcess, ErrorCode);

      CloseHandle(ProcessInfo.hProcess);

      CloseHandle(ProcessInfo.hThread);

      Result := True;

    end

    else

      ErrorCode := GetLastError;

  end;

end;

 

// Example, Beispiel:

 

procedure TForm1.Button1Click(Sender: TObject);

var

  ErrorCode: Cardinal;

begin

  StartAssociatedExe('c:test.doc', ErrorCode);

end;

 

Delphi - .....................................

 

neoturk: ...Get the width and height of a gif-file ?...

type

  TImageSize = record

    Width: Integer;

    Height: Integer;

  end;

 

function ReadGIFSize(Stream: TStream): TImageSize;

type

  TGifHeader = record

    Signature: array [0..5] of Char;

    Width, Height: Word;

  end;

var

  Header: TGifHeader;

begin

  FillChar(Header, SizeOf(TGifHeader), #0);

  Result.Width := -1;

  Result.Height := -1;

  with Stream do

  begin

    Seek(0, soFromBeginning);

    ReadBuffer(Header, SizeOf(TGifHeader));

  end;

  if (AnsiUpperCase(Header.Signature) = 'GIF89A') or

    (AnsiUpperCase(Header.Signature) = 'GIF87A') then

  begin

    Result.Width  := Header.Width;

    Result.Height := Header.Height;

  end;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

const

  FileName = 'D:test.gif';

var

  fs: TFileStream;

  gifsize: TImageSize;

begin

  fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);

  try

    gifsize := ReadGIFSize(fs);

    ShowMessage(Format('Breite %d Höhe %d', [gifsize.Width, gifsize.Height]));

  finally

    fs.Free;

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Get the width and height of a gif-file ?...

type

  TImageSize = record

    Width: Integer;

    Height: Integer;

  end;

 

function ReadGIFSize(Stream: TStream): TImageSize;

type

  TGifHeader = record

    Signature: array [0..5] of Char;

    Width, Height: Word;

  end;

var

  Header: TGifHeader;

begin

  FillChar(Header, SizeOf(TGifHeader), #0);

  Result.Width := -1;

  Result.Height := -1;

  with Stream do

  begin

    Seek(0, soFromBeginning);

    ReadBuffer(Header, SizeOf(TGifHeader));

  end;

  if (AnsiUpperCase(Header.Signature) = 'GIF89A') or

    (AnsiUpperCase(Header.Signature) = 'GIF87A') then

  begin

    Result.Width  := Header.Width;

    Result.Height := Header.Height;

  end;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

const

  FileName = 'D:test.gif';

var

  fs: TFileStream;

  gifsize: TImageSize;

begin

  fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);

  try

    gifsize := ReadGIFSize(fs);

    ShowMessage(Format('Breite %d Höhe %d', [gifsize.Width, gifsize.Height]));

  finally

    fs.Free;

  end;

end;

 

Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol