Anasayfa / Delphi (Sayfa 4)

Delphi

delphi

Pascal Abs function

Abs fonksiyonu, negatif veya pozitif bir sayının mutlak değerini döndürür. Örnek: uses System.SysUtils; var sayi1:Integer; sayi2:Double; sayi3:Real; begin try sayi1:=-765; sayi2:=-212.5; sayi3:=159.9; { TODO -oUser -cConsole Main : Insert code here } Writeln('Sayı 1 = ',Abs(sayi1)); Writeln('Sayı 2 = ',Abs(sayi2):2:2); Writeln('Sayı 3 = ',Abs(sayi3):2:2); Readln; except on E: Exception do …

Devamını Oku »

W1050 WideChar reduced to byte char in set expressions. Consider using ‘CharInSet’ function in ‘SysUtils’ unit.

Bu uyarı delphi 7 gibi eski sürümlerde geliştirdiğiniz uygulamaları delphinin yeni sürümlerine taşıdığınızda çıkar genel olarak kodunuzu şu şekilde değiştirmelisiniz //  if Key in [‘k’..’k’] + [‘K’..’K’] then btn_kasa.Click; // eski kod if CharInSet(Key, [‘k’..’k’, ‘K’..’K’]) then btn_kasa.Click; // yeni kod sebebi http://stackoverflow.com/questions/19419239/charinset-compiler-warning-in-delphi-xe4 linkte güzel bir şekilde açıklanmış.

Devamını Oku »

Delphi Intraweb SetCookie

Delphi intraweb ile SetCookie,GetCookie uses a iwinit,windows,IW.HTTP.Cookie function GetCookieValue(sName: String): String; function GetUTCDateTime: TDateTime; var GMTST: Windows.TSystemTime; begin windows.GetSystemTime(GMTST); result:=Sysutils.SystemTimeToDateTime(GMTST); end; function GetCookieValue(sName: String): String; begin Result := webapplication.Request.CookieFields.Values[sName]; end; procedure TFrm_Login.SetCookie; var ExpireOn : real; begin if ExpireIn <> 0 then ExpireOn := GetUTCDateTime + ExpireIn else ExpireOn:=-1; // …

Devamını Oku »

Delphi Yandex Translate Api

Merhaba Bu yazımızda Yandex Translete Api kullanarak delphi uygulamamız ile translate işlemi yapacağız. Öncelikle gerekenler yandex mail hesabınız olması gerekiyor daha sonra https://tech.yandex.com/translate/ adresinden translate işlemlerimiz de kullanacağımız api key imizi alıyoruz. Json web servisinden dönen sonucu parse etmek için https://code.google.com/p/superobject/downloads/list aracını kullanacağız. https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/ Adresinden desteklediği diller ve diğer teknik …

Devamını Oku »

Delphi Bmp dosyasını JPEG’e dönüştürme

uses kısmına jpeg unitini ekleyin. procedure TForm1.Button1Click(Sender: TObject); var MyJPEG : TJPEGImage; MyBMP : TBitmap; begin MyBMP := TBitmap.Create; with MyBMP do try LoadFromFile('c:\winnt\ACD Wallpaper.bmp'); MyJPEG := TJPEGImage.Create; with MyJPEG do begin Assign(MyBMP); SaveToFile('c:\winnt\ACD Wallpaper.JPEG'); Free; end; finally Free; end; end;

Devamını Oku »

Delphi Bir klasörün boyutunu öğrenmek

Bir klasörün boyutunu öğrenmek Bir klasördeki dosyaların kaç byte yer kapladığını öğrenmek için   function TForm1.GetDirectorySize(const ADirectory: string): Integer; var Dir: TSearchRec; Ret: integer; Path: string; begin Result := 0; Path := ExtractFilePath(ADirectory); Ret := Sysutils.FindFirst(ADirectory, faAnyFile, Dir); if Ret <> NO_ERROR then exit; try while ret=NO_ERROR do begin inc(Result, …

Devamını Oku »