Programlama yapalım ve Öğrenelim. - Delphi Eğitim28
  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

Küçük harfe dönüşüm Türkçe Karekterler

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Edit1: TEdit;

    Edit2: TEdit;

    Cb1: TCheckBox;

    procedure Button1Click(Sender: TObject);

    procedure Edit1KeyPress(Sender: TObject; var Key: Char);

    procedure Cb1Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

    procedure Edit1Exit(Sender: TObject);

  private

   //  Function kucult(Yazim:string):string;

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

  Function kucult(Yazim:string):string;

var

Harfim:char;

Sayim:Byte;

begin

for Sayim:=1 to length(yazim) do

begin

Harfim:=Yazim[sayim];

Case Harfim of

 

'A'..'H','J'..'Z':Harfim:=Chr(Ord(Harfim)+32);

'Ö': Harfim:='ö';

'Ğ': Harfim:='ğ';

'Ü': Harfim:='ü';

'Ş': Harfim:='ş';

'İ': Harfim:='i';

'Ç': Harfim:='ç';

'I': Harfim:='ı';

end;

Yazim[Sayim]:=Harfim;

end;

Kucult:=Yazim;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

       if cb1.Checked then

           Begin

           edit2.Enabled :=False;

           end

      else

     Begin

            Edit2.text:=kucult (edit1.text);

            edit2.Enabled :=True;

            edit2.Color := $00EDE212;

end;

    end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);

 

 var

harf:string;

begin

harf:=key;

harf:=KUCULT(harf);

key:=harf[1];

 

end;

 

procedure TForm1.Cb1Click(Sender: TObject);

begin

        if cb1.Checked then

           Begin

           Edit1.OnKeyPress := Edit1KeyPress;

           Edit2.Enabled :=False;

           Edit2.Clear;

          

           end

           else

          Begin

               edit1.OnKeyPress :=Nil  ;

               Edit2.Enabled :=True;

               Edit2.Color := ClWhite;

          end;

 

 

 

 

 

end;

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  edit1.OnKeyPress :=Nil ;

end;

 

procedure TForm1.Edit1Exit(Sender: TObject);

begin

Edit2.Clear;

end;

 

end.

 

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

 

Yaş Bulma

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, Mask;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Edit1: TEdit;

    Label1: TLabel;

    MaskEdit1: TMaskEdit;

    procedure Button1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

   uses math;

{$R *.DFM}

 

procedure TForm1.Button1Click(Sender: TObject);

 

   var

d:double;

a:Tdate  ;

begin

  try

  if MaskEdit1.Text = '  .  .    ' then

      begin

      showmessage ('Lütfen Tarih giriniz..') ;

      maskedit1.SetFocus ;

      exit;

     end;

 

    a:=now;

 

    d:=floor((a-(strtodate(MaskEdit1.Text )))/(365));

 

    if (d >= 150)  or (d <= -1) then

       begin

         showmessage ('Bu Tarihte İnsan mı Yaşar Dikkatli Yaz...!') ;

         exit;

       end;

     edit1.text:=floattostr(d);

      except

      begin

        showmessage ('Tarih Formatını Yanlış Girdiniz.') ;

        MaskEdit1.Text:='';

        edit1.text:='';

           end;

     end;

end;

 

end.

 

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

 

TMemo bileşeninde sayısal değer kontrolü

NeverFear - kaheri579@hotmail.com

 

1.TForm üzerine 1 adet TMemo bileşeni bırakın.

2.TMemo özelliklerini Height->21, Alignment->taRightJustify, WantReturns->False,

  WordWrap->False olarak ayarlama yapın.

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, ExtCtrls;

 

type

  TForm1 = class(TForm)

    Memo1: TMemo;

    procedure FormCreate(Sender: TObject);

    procedure Memo1Exit(Sender: TObject);

    procedure Memo1KeyPress(Sender: TObject; var Key: Char);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

function IsInteger(X: string): boolean;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  Memo1.Clear;

end;

 

function IsInteger(X: string): boolean;

var X_int: integer;

begin

  Result:= True;

  try

    X_int:= StrToInt(X);

  except on EConvertError do

    Result:= False;

  end;

end;

 

procedure TForm1.Memo1Exit(Sender: TObject);

begin

  if Memo1.Text <> '' then

  begin

     if not IsInteger(Memo1.Text) then //Memo1.Text'e girilen değerin sayısal olup

        //olmadığı kontrol ediliyor. Sayısal değilse "raise" devrede.

     raise EIntError.Create(''' ' + Memo1.Text + ' '' sayısal bir değer değil..!')

     else ShowMessage(''' ' + Memo1.Text + ' '' sayısal bir değer.');

  end;

end;

 

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);

begin

  if Key = #13 then Memo1Exit(Memo1);

end;

 

end.

 

NOT: IsInteger fonksiyonunu, Mart 2006'da drony takma isimli arkadaşımız göndermiş ve

     bu konuda başka kodlama yok. Ancak, arkadaşımız fonksiyonun kullanılması ile

     ilgili herhangi bir kod eklememiş. Bunun üzerine, ben de, kullanımına ait örnek

     kodlama gönderme ihtiyacı duydum. Ayrıca, yeni başlayanlar açısından yararlı

     olacağı düşüncesindeyim.

 

 

İşinizi görmesi dileğimle,

Çalışmalarınızda başarılar dilerim.

 

NeverFear - kaheri579@hotmail.com

 

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

 

WEB BROWSER KULLANIMI

formunuzun internet yaprağından bir adet web browser secin ve 4 adet buton 1.butonu (ana sayfa) 2.Butonu nceki sayfa) 3.Butonu (sonraki sayfa) ve 4.Butonu (Ara)

olarak atlandırın son olarak bir adette combobox yapıştırın

aşağıdaki kodları gerekli yerlere uygulayın.

 

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, OleCtrls, SHDocVw;

 

type

  TForm1 = class(TForm)

    WebBrowser1: TWebBrowser;

    ComboBox1: TComboBox;

    Button1: TButton;

    Button2: TButton;

    Button3: TButton;

    Button4: TButton;

    procedure FormCreate(Sender: TObject);

    procedure ComboBox1Change(Sender: TObject);

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    procedure Button3Click(Sender: TObject);

    procedure Button4Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

 

ComBoBox1.Items.Add('http://www.tugrulhamal.somee.com');

ComBoBox1.Items.Add('http://www.delphi.freezoka.com/index.php');

ComBoBox1.Items.Add('http://www.google.com');

ComBoBox1.Items.Add('http://.....................................');

ComBoBox1.Items.Add('http://www.superonline.com');

ComBoBox1.Items.Add('http://www.mynet.com');

ComboBox1.ItemIndex:=0;//ilk elemanı göster

WebBrowser1.Navigate(ComboBox1.Text);

end;

 

procedure TForm1.ComboBox1Change(Sender: TObject);

begin

WebBrowser1.Navigate(ComboBox1.Text);

Button2.Enabled:=true;

Button3.Enabled:=true;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

WebBrowser1.GoHome;

ComboBox1.Text:=WebBrowser1.LocationURL;

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

try

WebBrowser1.GoBack;

except

Button2.Enabled:=false;

Button3.Enabled:=true;

end;

end;

procedure TForm1.Button3Click(Sender: TObject);

//Sonraki Sayfaya Git

begin

try

WebBrowser1.GoForward;

except

Button3.Enabled:=false;

Button2.Enabled:=true;

end;

end;

procedure TForm1.Button4Click(Sender: TObject);

//Arama Sayfasına Git

begin

WebBrowser1.GoSearch;

ComboBox1.Text:='www.mmicrosoftsourch.com';

end;

end.

 

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

 

MOUSE Simulasyon Yeni DBLCLİCK RCLİCK

/////////////click

begin

mouse_event(mouseeventf_leftdown,0,0,0,0);

mouse_event(mouseeventf_leftup,0,0,0,0);

end;

//////////////////

 

 

 

////////// Double click

 

var

i:integer;

for i:=0 to 1 do

begin

mouse_event(mouseeventf_leftdown,0,0,0,0);

mouse_event(mouseeventf_leftup,0,0,0,0);

end;

/////////////////////

 

 

 

 

 

 

/////// right click

begin

mouse_event(mouseeventf_rightdown,0,0,0,0);

mouse_event(mouseeventf_rightup,0,0,0,0);

end;

 

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

 

ExThreads Unit Basitçe Thread Kullanalım.

bu uniti sizin için hazırladım bir çoğumuz hala thread kullanımını bilmiyor.

threadi başlattıkdan sonra kapatmasınada dikkat etmek gerekir.

thread handlelerini bir yerde saklamak thread sonunda kapattırmak ve

üstüne üstlük thread sayısı arttıkça eziyet haline gelebilir.

 

beginthread ile bir thead açtığımızda fonksiyon işletilip bittiğinde

o thread durmuş olarak hala bellekden alan götürür. bunu engellemek için

thread ile işiniz bittiğinde kapatmanız gerekir. bu işi ExThreads uniti üstlenir.

 

birde video kaydettim burdan;

 

http://rapidshare.com/files/100114739/exthreads.avi.html

 

 

Unit1 Pas

---------

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, ExtCtrls;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Timer1: TTimer;

    procedure Button1Click(Sender: TObject);

    procedure Timer1Timer(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

Uses ExThreads;

 

 

procedure Prosedurumuz(TID:Pointer);

begin

// Kodlarımızı buraya yazalım

 

 

 { ---- }

 StopThread(TID);

 { İşlem Bittiğinde Bu Çağrılmalı her ne kadar thread durmuş olsada hala bellekde }

End;

 

procedure TForm1.Button1Click(Sender: TObject);

Var

 i:longint;

 

begin

 for i:=1 to 500 do begin StartThread(Addr(Prosedurumuz)); end; // 500 tane thread aç.

 

{

 if StartThread(Addr(Prosedurumuz)) then

 begin

  thread çalıştırıldı

 end

 else

 begin

  thread çalıştırılamadı

 end;

}

end;

 

procedure TForm1.Timer1Timer(Sender: TObject);

begin

 Form1.Caption:=IntToStr(Threads_ActiveCount)+' İş Parçacığı.';

// if Threads_ActiveCount=0 then halt; // kaç thread aktif şu an..

 Application.ProcessMessages;

end;

 

end.

 

 

-------------------------

 

 

 

 

ExThreads.pas

-------------

Unit ExThreads;

 

interface

 

uses

  Windows;

 

 Function StartThread(ThreadFunc: TThreadFunc):Boolean;

Procedure StopThread(TID:Pointer);

 

Function Threads_ActiveCount:LongInt;

 

Implementation

 

Const

 MaxThread=65535;

 

Var

 Threads:Array[1..MaxThread] Of LongWord;

 

Function GetEmty_TID:LongInt;

Var

 I:LongInt;

 

Begin

 Result:=0;

 For I:=1 To MaxThread Do

 Begin

  If Threads[I]=0 Then

  Begin

   Result:=I;

   Exit;

  End;

 End;

End;

 

Function Threads_ActiveCount:LongInt;

Var

 I:LongInt;

 

Begin

 Result:=0;

 For I:=1 To MaxThread Do

 Begin

  If Threads[I]>0 Then

  Begin

   Result:=Result+1;

  End;

 End;

End;

 

Procedure StopThread(TID:Pointer);

Begin

 CloseHandle(Threads[Integer(TID)]);

 Threads[Integer(TID)]:=0;

End;

 

Function StartThread(ThreadFunc: TThreadFunc):Boolean;

Var

 Temp:DWORD;

  TID:LongInt;

 

Begin

 Result:=False;

 TID:=GetEmty_TID;

 If TID>0 Then

 Begin

  Threads[TID]:=BeginThread(nil, 0, Addr(ThreadFunc), Pointer(TID), 0, Temp);

  SetThreadPriority(Threads[TID], THREAD_PRIORITY_HIGHEST);

  If Threads[TID]>0 Then

  Begin

   Result:=True;

  End;

 End;

End;

 

{ *-*--*-*----**-*--*-**-*-*--**--*-*-*-*-*-*-*-* }

 

Var

 I:LongInt;

 

Begin

 For I:=1 To MaxThread Do

 Begin

  Threads[I]:=0;

 End;

End.

 

----------------------------------------------

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