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

Döngü yerine goto ile saydirmak

Bir programda döngü kullanmanin yasak olduğunu varsayarsak o zaman döngünün yerini alabilecek başka bir imkan bulabiliriz, iste Ansi C komitesi tarafından olup olmaması tartışılan goto deyimi.

 

 

/********************** Borland C++ Builder **********************/

 

void __fastcall TForm1::Button1Click(TObject *Sender)

{

 

    int say = 0;

hedef:

    ++say;

    Memo1->SelText = say;

    if( say < 100)

        goto hedef;

       

}

 

 

 

/************************ Standart C  ************************/

 

#include <stdio.h>

 

void main()

{

    int say = 0;

hedef:

    ++say;

    printf("%dt",say);

    if( say < 100)

        goto hedef;

}

 

C++ Builder - .....................................

 

pixel mm ve mm pixel çevrimi

//değer ekran çözünürlüğüne göre değişebiliyor

//yani 0.3125 ile 0.36 arasında bir değer alabiliyor.

// yuvarlama yapıldığı için kesin sonuç isteyen uygulamalarda sanırım     kullanılmamalı

 

function MmToPx(mm: real): real;

begin

    Result := round(mm/0.3125);

end;

function PxToMm(mm: integer): integer;

begin

    Result := round(mm*0.3125);

end;

 

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

 

Bit Erişimi

Arkadaşlar buyrun çok kapsamlı bir kod parçası içinde bir çok fonksiyon var

 

unit FlagsMgr;

 

interface

 

uses Classes, Math, SysUtils, Dialogs;

 

type TFlagType = cardinal; // This can be changed to any integer type.

// If signed - don't mess with the sign bit by using any

// negative values or using that highest bit position.

 

{These routines work on positive values for integer types.

If unsigned, then all bits are available = SizeOf(TFlagType)*8

If signed then SizeOf(TFlagType)*8-1 are available.}

 

{Using "not" on signed integers flips the sign bit, not all bits as it does on

unsigned integers. Because these routines work on signed integers as well, the

"not" operator isn't included.}

 

function GetFlagValue(Expn: byte): TFlagType;

function GetFlagExpon(Flag: TFlagType; var Expn: ShortInt): boolean;

procedure InsertFlag (var Flags: TFlagType; Flag: TFlagType);

function ContainsFlag (Flags, Flag: TFlagType): boolean;

function ContainsCommonFlags (Flags1, Flags2: TFlagType): boolean;

function CommonFlags (Flags1, Flags2: TFlagType): TFlagType;

procedure RemoveFlag (var Flags: TFlagType; Flag: TFlagType);

procedure RemoveCommonFlags( var Flags1, Flags2: TFlagType; FromWhich: integer);

procedure RemoveUniqueFlags( var Flags1, Flags2: TFlagType; FromWhich: integer);

 

function IntToBinary(AnInt: TFlagType; Commas: boolean): string;

 

function NextPowerOfTwo (Flag: TFlagType): TFlagType;

function IsPowerOfTwo (Flag: TFlagType): boolean;

function PosHighestOnBit(Flags: TFlagType): integer;

function DecToBase(DecNo: integer; Base: word): string;

function BaseToDec(BaseNo: string; Base: word): integer;

 

implementation

 

{******************************* Flag Manipulation ***************************}

{Flags, as it is used here is a number that represents a series of yes / no,

true / false conditions - one for each bit. The bit is either on or off. A flag

to add to flags item it a number that has a decimal value of a power of two.

That is, it's positive 1, 2, 4, 8, 16, 32, 64, 128, 256...

 

An easy way to implement this to use the integer values [0..(SizeOf[TFlagType]*8-1)]

as exponents powering 2, that way for int64 you're dealing with 0..63 rather than

 

Example:

InsertFlag (MyFlags, GetFlagValue(5));

Sets the bit which represent 2^5 (0010 0000) to true or "1" in MyFlags

Doesn't effect other bits which may already be set.}

 

function GetFlagValue(Expn: byte): TFlagType;

// could be called - PowerTwo(Expn: byte): TFlagType;

// returns an integer value = to 2^Expn

//var i: TFlagType;

begin

Result := TFlagType(1) shl Expn;

{ Also could be performed:

Result := round(power (2, Expn));}

end;

 

function GetFlagExpon(Flag: TFlagType; var Expn: ShortInt): boolean;

// returns true if the Flag has only one bit set on, and rest are off

// that is, the value of Flag is an integer power of two

// and returns that exponent value in Expn. If Flag has more than one

// bit set to true, return value of function is false

var

i,

MaxEx: byte;

TryFlag: TFlagType;

begin

Result := false;

Expn := -1;

if Flag > 0 then begin

MaxEx := SizeOf(TFlagType)*8;

if Low(TFlagType) < 0 then dec(MaxEx); // TFlagType is currently cardinal

// if I change flag type to a different type

// this code may be necessary

for i := 0 to MaxEx do begin

TryFlag := GetFlagValue(i);

if ContainsFlag(Flag, TryFlag) then begin

RemoveFlag(Flag, TryFlag);

if Flag = 0 then begin

Expn := i;

Result := true;

end;

Break;

end;

end;

end;

end;

 

procedure InsertFlag (var Flags: TFlagType; Flag: TFlagType);

begin

Flags := Flags or Flag; // bitwise or turns on the flag if it exists or not

end;

 

function ContainsFlag (Flags, Flag: TFlagType): boolean;

begin

Result := (Flags and Flag) = Flag;

end;

 

function ContainsCommonFlags ( Flags1, Flags2: TFlagType): boolean;

begin

Result := ((Flags1 and Flags2) > 0);

end;

 

procedure RemoveFlag (var Flags: TFlagType; Flag: TFlagType);

// Flag can contain one or many of Flags values - they will all be removed

begin

Flag := not Flag;

Flags := Flags and Flag;

end;

 

function CommonFlags ( Flags1, Flags2: TFlagType): TFlagType;

// Result = a value with all the flags that are common to Flags1 & Flags2.

begin

Result := Flags1 and Flags2;

end;

 

procedure RemoveCommonFlags( var Flags1, Flags2: TFlagType; FromWhich: integer);

// FromWhich indicates which flags value you want to remove the common flags

// from. Possible values are 1: Remove from Flags1; 2: Remove from Flags2;

// and 3: Remove from both;

var Com: TFlagType;

begin

Com := CommonFlags (Flags1, Flags2);

if (FromWhich = 1) or (FromWhich = 3) then RemoveFlag(Flags1, Com);

if (FromWhich = 2) or (FromWhich = 3) then RemoveFlag(Flags2, Com);

end;

 

procedure RemoveUniqueFlags( var Flags1, Flags2: TFlagType; FromWhich: integer);

// FromWhich indicates which flags value you want to remove the unique flags

// from. Possible values are 1: Remove from Flags1; 2: Remove from Flags2;

// and 3: Remove from both;

var Uniq: TFlagType;

begin

Uniq := Flags1 xor Flags2;

if (FromWhich = 1) or (FromWhich = 3) then RemoveCommonFlags(Flags1, Uniq, 1);

if (FromWhich = 2) or (FromWhich = 3) then RemoveCommonFlags(Uniq, Flags2, 2);

end;

 

function PosHighestOnBit(Flags: TFlagType): integer;

// returns the position ofthe last "On" bit in AFlags counting from low bit to high bit

//

var

i: byte;

MaxI: byte;

Flag: TFlagType;

begin

Result := 0;

i := 0;

MaxI := SizeOf(TFlagType)*8 - 1;

repeat

Flag := GetFlagValue(i);

if ContainsFlag(Flags, Flag) then

Result := i + 1;

inc(i);

until (Flag > Flags) or (i = MaxI);

end;

 

function IntToBinary(AnInt: TFlagType; Commas: boolean): string;

// Visualize MyBits [0..IntSize-1] where 0 is the leftmost bit

var

MyBits: TBits;

n: byte; // the exponent

RemInt: TFlagType;

Cntr,

Offset: byte;

IntSize: byte;

begin

IntSize := SizeOf(TFlagType)*8;

MyBits := TBits.create;

MyBits.size := IntSize;

RemInt := AnInt;

if RemInt < 0 then begin // condition check may be required if TFlagType <> cardinal

MyBits.Bits[IntSize-1] := true;

RemInt := RemInt*(-1)-1;// change sign and shift value by one

end;

if Low(TFlagType) < 0 then Offset := 2 // condition check may be required if TFlagType <> cardinal

else Offset := 1;

for n := (MyBits.Size - Offset) downto 0 do begin

// 2^n represents the values held in each place from the highest down to the lowest

// check a value against 2^n, if the value is greater than 2^n, then it contains it

// and set the bit to on.

 

// if RemInt >= round(Power(2, n)) then begin

if RemInt >= GetFlagValue(n) then begin

MyBits.Bits[n] := true;

// RemInt := RemInt - round(Power(2,n));

RemInt := RemInt - GetFlagValue(n);

end

else begin

MyBits.Bits[n] := false;

end;

end;

 

// now convert to string

Result := '';

Cntr := 0;

for n := (MyBits.Size - 1) downto 0 do begin

if MyBits.Bits[n] then Result := Result + '1'

else Result := Result + '0';

inc(Cntr);

if (Cntr <> IntSize) and ((Cntr mod 4) = 0) then

if Commas then Result := Result + ',';

end;

MyBits.free;

end;

 

function IsPowerOfTwo (Flag: TFlagType): boolean;

// Returns true if the value of Flag is a power of two for an exponent in the

// range of 0 to MaxExp. A Flag's valid range is 1..2^62

// This allows a FlagContainer to have up to 63 possible flags

var

exp : word;

MaxExp : integer;

begin

MaxExp := SizeOf(TFlagType)-1;

Result := false;

for exp := 0 to MaxExp do begin

if Flag = round(Power(2, exp)) then begin

Result := true;

break;

end;

if Flag < round(Power(2, exp)) then

break;

end;

end;

 

function NextPowerOfTwo (Flag: TFlagType): TFlagType;

// returns the next power of two higher than the current value for flag

// or zero if the exponent > MaxExp (62).

var

exp: Word;

MaxExp : integer;

begin

MaxExp := SizeOf(TFlagType)-1;

exp := 0;

while (exp <= SizeOf(TFlagType)-1) and (round(Power(2, exp)) < Flag) do inc(exp);

if exp > MaxExp then Result := 0

else begin

if Flag < (round(Power(2, exp))) then

Result := round(Power(2, exp))

else

Result := round(Power(2, exp+1));

end;

end;

 

function DecToBase(DecNo: integer; Base: word): string;

{ converts any decimal integer to any base in the range of [2..16]

and returns the converted number as a string.

 

Example of logic implemented for base five

Decimal 46 = 141 in base 5

First iteration of while loop

46/5 = 9.2, Drop 9 & multiply 0.2 * 5 = 1 -> right most digit

Next iteration of while loop, process dropped 9

9/5 = 1.8, Drop 1 & multiply 0.8 * 5 = 4 -> next left digit

Next iteration of while loop, process dropped 1

1/5 = 0.2, Drop 0 & multiply 0.2 * 5 = 1 -> left most digit

Rem is zero - end processing.

}

var

Rem: integer;

NextDig: integer;

ADig: string;

begin

Result := '';

if (Base >= 2) and (Base <= 16) then begin

if DecNo = 0 then Result := '0'

else begin

Rem := Abs(DecNo); // get positive value

while Rem <> 0 do begin

NextDig := Round(frac(Rem/Base)*Base);

case NextDig of

10: ADig := 'A';

11: ADig := 'B';

12: ADig := 'C';

13: ADig := 'D';

14: ADig := 'E';

15: ADig := 'F';

else ADig := IntToStr(NextDig);

end; // case

Result := ADig + Result;

Rem := Round(int(Rem/Base));

end; // while

if DecNo < 0 then Result := '-' + Result;

end; // else

end

else ShowMessage('Invalid base passed to function "DecToBase"');

end;

 

function BaseToDec(BaseNo: string; Base: word): integer;

{ converts a value in any base represented by a string

to a decimal integer where base is in the range of [2..16]

and returns the converted number as an integer.

 

Example of logic implemented for base five

Base 5 # 141 = decimal 46

First iteration of while loop

left most digit is 1

1 / 5 = 0.2; Add nothing from above = 0.2

0.2 * 5 = 1

Next iteration of while loop

next digit to right is 4

4 / 5 = 0.8; Add 1 from above to 0.8 = 1.8

1.8 * 5 = 9

Next iteration of while loop

next digit to right is 1

1 / 5 = 0.2; Add 9 from above to 0.2 = 9.2

9.2 * 5 = 46

No more digits to process.}

 

var

Rem: string;

ChStr: string;

ADig: integer;

begin

Result := 0;

if (Base >= 2) and (Base <= 16) then begin

if BaseNo <> '0' then begin

// get absolute value

if BaseNo[1] = '-' then Rem := copy(BaseNo, 2, length(BaseNo))

else Rem := BaseNo;

while Rem <> '' do begin

case Rem[1] of

'A', 'a': ADig := 10;

'B', 'b': ADig := 11;

'C', 'c': ADig := 12;

'D', 'd': ADig := 13;

'E', 'e': ADig := 14;

'F', 'f': ADig := 15;

else ADig := StrToInt('' + Rem[1]);

end;

Result := Round((Result + (ADig/Base)) * Base);

Rem := copy(Rem, 2, length(Rem));

end; // while

if BaseNo[1] = '-' then Result := (-1) * Result;

end; // else

end

else ShowMessage('Invalid base passed to function "BaseToDec"');

end;

 

end.

 

 

 

 

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

Save as a unit to use - not a form.

From Delphi menu: File|New

In ensuing dialog, select Unit.

Delphi will open a new unit.

Under the unit's name: "unit Unit1;"

Copy and paste my entire unit.

Then delete my unit's name line: "unit FlagsMgr"

Then do a file SaveAs "FlagsMgr"

Save either in Delphi's Bin directory, or in a folder that is in your Application's Search Path.

 

Then in your form's uses clause, add "FlagsMgr".

 

All the functions declared in FlagsMgr's interface section are then available to your form.

 

 

type TFlagType = cardinal; deki cardinal i herhangi bir integer türüne çevirip kullanın yoksa insertflag vs gibi fonksiyonlarda tür uyuşmazlığı hatası veriyor.

 

InsertFlag (Deg, GetFlagValue(0)); // set low bit on

InsertFlag (Deg, GetFlagValue(1)); // set second bit from right on

InsertFlag (Deg, GetFlagValue(2)); // set third bit from right on

 

RemoveFlag (Deg, GetFlagValue(0)); // turn off low bit

RemoveFlag (Deg, GetFlagValue(1)); // turn off second bit

RemoveFlag (Deg, GetFlagValue(2)); // turn off third bit

 

 

The value of Deg is stored & manipulated as an integer type.

To view the binary value, you must use function IntToBinary which returns a string representation of the binary value.

 

To view the binary value as a string in a TEdit:

 

 

Edit1.text := IntToBinary(Deg, true);

 

If you prefer a space rather than commas, you can change the 3rd to last line of IntToBinary where the commas are added to the result to insert a space instead, or write a similar function that adds spaces.

 

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

if you want to view your value as octal:

 

 

Edit1.text := DecToBase(Deg, 8);

 

or hex:

 

 

Edit1.text := DecToBase(Deg, 16);

 

I see that in the DecToBase I have DecNo declared as an integer instead of TFlagType. I don't think that will cause you trouble.

 

Delphi provides a library function IntToHex which also returns a string.

 

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

If you want to change a binary string representation back to an integer value, you can do something like this.

I haven't tried it.

 

 

function BinaryToInt(sBi: string): integer;

var

i: integer;

CleanSBi: string;

begin

CleanSBi := '';

 

// remove non binary characters from string

for i := 1 to length(sBi) do

if (sBi[i] = '0') or (sBi[i] = '1') then CleanSBi := CleanSBi + sBi[i];

 

 

Result := BaseToDec(CleanSBi, 2);

end;

 

with that, you should be able to display the value of your edit in a label

 

 

procedure TForm1.Edit1Change(Sender: TObject);

begin

Label1.caption := IntToStr(BinaryToInt(Edit1.text));

end;

 

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

 

ses hakında

Arkadaşlar yardıma ihtiyacım var

program aracılığı ile mikrofonda ses varmı kontrol etmek ısıtyorum.

varsa bu sesi ag üzerinden dinlemek istiyorum

 

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

 

text to speech türkçe sentezleme

arkadaşlar türkçe metinleri okuyabilecek bir türkçe konuşma motoruna ihtiyacım var. böyle bir proje ile ilgilenen

   ve çözüm üreten arkadaşlardan acil yardım bekliyorum.

 

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

 

GOLAKS Edite Yazılan Tüm Harfler Büyük ve Türkçe Karakter İçermiyor

editte görünmesini istediğiniz gibi değiştirin..:= Kolay Gelsin

********************************************************************************

Function THamderiForm.BuyukHarfC(Harf: Char): Char;

  begin

   case Harf of

 'ı': Result:='I';

 'ğ': Result:='G';

 'ü': Result:='U';

 'ş': Result:='S';

 'i': Result:='I';

 'ö': Result:='O';

 'ç': Result:='C';

   else

  Result:=upCase(Harf);

 end;

end;

 

 

KULLANIMI

----------

key:=BuyukHarfC(key);

 

********************************************************************************

 

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

 

Arkadşalr open gl hakkında bilgi

Arkadaşlar Lütfen opengl Hakkında Türkçe kaynak bulabilirseniz ben le irtibata geçermisiniziz.

 

Saygılarımla

 

mayazilim@hotmail.com

 

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

 

ingilizce cümle+kelime ezber programmı+source code

http://rapidshare.com/files/14780032/Learn_English.rar.html

 

gerçekten güzel hazırlanmış ancak yanınızda bir çince sözlük lazım bu programı sadece kelime değil cümle grammer ve teknik terimlerin ezberlenmesi amacı ile de kullanılabilir

 

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

 

mssql function two output parametre

declare @kr1 float ;

declare @kr2 float ;

declare @sql nvarchar(500);

 

 

SET @sql = N' Select @kr1=euro,@kr2=usd From dovgun output';

 

 

EXEC sp_executesql @sql,N'@kr1 float OUTPUT,@kr2 float OUTPUT',

@kr1 = @kr1 output,@kr2=@kr2 output;

 

print convert(varchar(20),@kr1)+':'+convert(varchar(20),@kr2);

 

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

 

delphi--Hesap Mak.

{öncelikle forma 4 tane radiobutton, 3 tane edit, bir tane button ekleyin}

//basit ama çorbada benimde tuzum olsun.

//acemiler için iyi bir örnek.

 

procedure TForm1.Button1Click(Sender: TObject);

begin

if radiobutton1.checked=true then // eğer radiobtn1 seçili ise..

edit3.Text:=inttostr(strtoint(edit1.Text)+strtoint(edit2.Text));

if radiobutton2.checked=true then

edit3.Text:=inttostr(strtoint(edit1.Text)-strtoint(edit2.Text));

if radiobutton3.checked=true then

edit3.Text:=inttostr(strtoint(edit1.Text)*strtoint(edit2.Text));

if radiobutton4.checked=true then

edit3.Text:=inttostr(strtoint(edit1.Text) div strtoint(edit2.Text));

// bunu dahada geliştirip üs alma özelliği vesaire ekleyebiliriz.

// inttostr integer (numeric) değerden string(karakter) değerre çevirir.

//strtoint bi üstteki olayın tam tersi:)... teşekkürler.

//H!PNO-TECH MASTER

end;

 

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

 

Çarpım Tablosu

//Özellikle başlangıç seviyesideki arkadaşlar için yazdım.

//Çorbaya bi tutam tuz da biz atalım değilmi ya...?

 (* Kodları dikkatlice incelerseniz, pekçok alt konuyu içinde barındırıyor.

    1- Image gibi canvas özelliği olan bileşinler üzerine yazı yazmak,

       çerçeve çizmek.

    2- Image içeriğini temizlemek.

    3- iç içe for döngüsü ( matris hazırlamak).

    4- Width do deyimi kullanmak.

    5- String formatlamak.*)

//umarım faydası olur.

unit Unit1;

 

interface

 

uses

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

  Dialogs, StdCtrls, ExtCtrls;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Button2: TButton;

    Image1: TImage;

    Label1: TLabel;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.Button1Click(Sender: TObject);

var

  i,j,kolon,satir: Byte;

  str: String;

begin

  kolon := 15;

  satir := 10;

    for i:=1 to 10 do

    begin

       for j:=1 to 10 do

       begin

       {String formatla.     %-3s = IntToStr(i*j) yi temsil eder.3 rakamı stringin

                               uzunluğunu, - işareti sola yaslanacağını belirtir.

                                - işareti olmazsa string sağa dayalı gösterilir.}

        str:= Format('%s %s %s %s %-3s',

                    [IntToStr(i),'x',IntToStr(j),'=',IntToStr(i*j)]);

        //Image içine yaz.

        Image1.Canvas.TextOut(kolon, satir+(j*13), str);

       end;

       kolon:= kolon+60;

            if i=5 then

            begin

            kolon :=15;

            Satir := 147;

            end;

    end;

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

   Image1.Picture:= Nil; //Image'yi temizle.

   Image1.Canvas.Rectangle(4,4,330,308);

end;

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  //Image bileşeninin konumunu ayarla.

  With Image1 do

  begin

    Left:= 32;

    Top:= 32;

    Height:= 313;

    Width:= 335;

    Canvas.Rectangle(4,4,330,308); //Çerçeve çiz

  end;

end;

 

end.

 

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

 

SMTP Mail Gönderme

System.Web.Mail

 

 

msgMail             :=  MailMessage.Create;

// Kullandığını Mail server kullanıcı adı ve şifre onaylama istiyorsan

msgMail.Fields.Add('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate',Convert.ToString(1) ); // basic

msgMail.Fields.Add('http://schemas.microsoft.com/cdo/configuration/sendusername','ercument');

msgMail.Fields.Add('http://schemas.microsoft.com/cdo/configuration/sendpassword','sifre');

 

msgMail.From        := 'ercumentsari@gmail.com';

msgMail.&To         := 'ercument@hotmail.com';

msgMail.Subject     := 'Konu';

msgMail.Body        := 'Selan'

 

SmtpMail.SmtpServer := SMTPServer;

SmtpMail.Send(msgMail);

 

Delphi.NET - .....................................

 

Tablodaki Kayıt Sayısı FireBird (Golaks)

Golaks Bilgi İşlem Deri Üretim Yazılımları www.golaks.com Bilgileriniz Kayda Değerse..!

 

with IBQuery1 do

    begin

       SQL.Clear;

       SQL.Add('Select Count(*) as KAYIT_SAYISI from Bilgi');

       SQL.Add('Where (il =:A1) and (ilce =:A2) and (Kurum =:A3)');

       ParamByName('A1').AsString:=il.Text;

       ParamByName('A2').AsString:=ilce.Text;

       ParamByName('A3').AsString:=Kurum.Text;

       Open;

       Label5.Caption:='Kayıt Sayısı   :   '+IntToStr(FieldByname('KAYIT_SAYISI'));

    end;

 

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

 

cxgrid string grid gibi kulanma

iNo := 4000;

  asil.BeginUpdate;

  asil.DataController.RecordCount := iNo;

  for i := 0 to iNo-1 do

  begin

  asil.DataController.Values[i, 0] := 'aaa';

  asil.DataController.Values[i, 1] := 'bbb';

  end;

  asil.EndUpdate;

 

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

 

C:Program~1 gibi adresleri uzatma

//-----------DECLARED-----------

//------------MoRFiN------------

//---declared@celikforum.info---

 

 

  //implementation'ın altına

 

function GetLongPathName(lpszShortPath: PChar; lpszLongPath: PChar;

  cchBuffer: DWORD): DWORD; stdcall; external kernel32 Name 'GetLongPathNameA';

// -----------------------------------------------------------------------------

 

function WinAPI_GetLongPathName(const ShortName: string): string;

begin

  SetLength(Result, MAX_PATH);

  SetLength(Result, GetLongPathName(PChar(ShortName), PChar(Result), MAX_PATH));

end;

 

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

 

cxgrid IndicatorCell sayaç

procedure Tislmlistf.DBGrid1CustomDrawIndicatorCell(

  Sender: TcxGridTableView; ACanvas: TcxCanvas;

  AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);

var

  AText: string;

  ARect: TRect;

begin

 

  if not (AViewInfo is TcxGridIndicatorRowItemViewInfo) then

    exit;

  ACanvas.Brush.Color := AViewInfo.Params.Color;

  ACanvas.FillRect(AViewInfo.Bounds);

  ACanvas.Pen.Color := clBlack;

  ACanvas.Canvas.Rectangle(AViewInfo.Bounds);

  ARect := AViewInfo.Bounds;

  InflateRect(ARect, -3, -3);

  AText:=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);

  DrawText(ACanvas.Handle, PChar(AText), Length(AText), ARect, DT_VCENTER or DT_CENTER);

  ADone := True;

 

end;

 

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

 

mssqlde 2 tarih arası gun saat

CREATE PROCEDURE TarihFarki

@start AS SMALLDATETIME,

@end AS SMALLDATETIME

AS

 

DECLARE @sure BIGINT

DECLARE @dakika INT

DECLARE @saat INT

DECLARE @gun INT

DECLARE @MSG AS VARCHAR(64)

 

SET @gun=0

SET @sure=DATEDIFF(MINUTE,@start, @end)

 

IF (@sure>=1440)

BEGIN

    SET @gun=CAST((@sure/1440) AS INT)

    SET @sure=@sure-@gun*1440

END

SET @dakika=@sure%60

SET @saat=CAST((@sure/60) AS INT)

SET @MSG='İki tarih arasındaki fark ' + CAST(@gun AS VARCHAR(5))  +' gün '  + CAST(@saat AS VARCHAR(5)) + ' saat '  + cast(@dakika AS VARCHAR(5)) + ' dakika'

 

SELECT  @MSG

 

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

 

Akim Shahverdiyev - (Comp info)

//Bu proqram Delphi-ye yeni bashlayanlar icin. Ben sizlere Azerbeycandan

//katiliyorum. Gorushuruz:)  Dr.Akim

 

 

unit Unit1;

 

interface

 

uses

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

  StdCtrls, Psock, NMHttp;

 

type

  TForm1 = class(TForm)

    NMHTTP1: TNMHTTP;

    Edit1: TEdit;

    Edit2: TEdit;

    Edit3: TEdit;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    Edit4: TEdit;

    Label6: TLabel;

    procedure FormActivate(Sender: TObject);

    procedure Label1Click(Sender: TObject);

    procedure Label5Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

   function WhichLanguage:string;

var

  ID: LangID;

  Language: array [0..100] of char;

begin

  ID := GetSystemDefaultLangID;

  VerLanguageName(ID, Language, 100);

  Result := string(Language);

  end;

  function GetCurrentUserName: string;

const

  cnMaxUserNameLen = 254;

var

  sUserName: string;

  dwUserNameLen: DWORD;

begin

  dwUserNameLen := cnMaxUserNameLen - 1;

  SetLength(sUserName, cnMaxUserNameLen);

  GetUserName(PChar(sUserName), dwUserNameLen);

  SetLength(sUserName, dwUserNameLen);

  Result := sUserName;

end;

 

procedure TForm1.FormActivate(Sender: TObject);

var

User_name:array[0..255] of char;

BufferSize:DWORD;

begin

  BufferSize:=SizeOf(User_name);

  GetComputerName(@User_name,BufferSize);

  edit3.text:=(User_name);

   edit4.text:=whichlanguage;

edit1.text:=(nmhttp1.localip);

 edit2.text:=(GetCurrentUserName);

  end;

 

procedure TForm1.Label1Click(Sender: TObject);

begin

 

 ShellExecute(Handle,

               'open',

               'http://akim.iatp.az',

               nil,

               nil,

               SW_SHOW);

end;

 

procedure TForm1.Label5Click(Sender: TObject);

begin

 ShellAbout(0,'AKIM Soft-"Comp info"','Akim Shahverdiyev',Application.Icon.Handle);

end;

 

end.

 

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

 

mssql table da insert anında  id nosunu yakalama

INSERT INTO banka

      (ad)

VALUES

      ('dvd')

 

SELECT SCOPE_IDENTITY()

go

 

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

 

CD-Rom sürücüye CD takılıp/çıkartıldığından haberdar olmak.

//Bu işlemden haberdar olmak için WM_DEVICECHANGE isimli sistem mesajını dinlememiz gerekiyor.

 

private

procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;

 

...

 

procedure TForm1.WMDeviceChange (var Msg: TMessage);

const

  CD_IN  = $8000;

  CD_OUT = $8004;

var

  Mesaj : String;

begin

  inherited;

  case Msg.wParam of

    CD_IN  : Mesaj := 'Medya Takıldı';

    CD_OUT : Mesaj := 'Medya Çıkarıldı';

  end;

end;

 

                                                                   {Ömer UZUNER}

 

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

 

Klasör Paylaşımda mı?

uses

  ShellAPI,

  ShlObj;

 

...

var

  FileInfo : TSHFileInfo;

  S: string;

begin

  S := IncludeTrailingPathDelimiter('C:Klasör_Adı');

  FillChar(FileInfo, SizeOf(FileInfo), #0);

  FileInfo.dwAttributes := SFGAO_SHARE;

  if SHGetFileInfo(PChar(S), 0, FileInfo, SizeOf(TSHFileInfo), SHGFI_ATTRIBUTES) = 0 then RaiseLastOSError;

  if FileInfo.dwAttributes and SFGAO_SHARE <> 0 then

   ShowMessage('Paylaşımda')

  else

   ShowMessage('Paylaşılmamış');

end;

 

                                                                   {Ömer UZUNER}

 

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

 

basit bir word örneği

procedure TForm1.bold1Click(Sender: TObject);

begin

bold1.Checked:=not bold1.Checked;

if bold1.Checked then

                   memo1.Font.Style:=memo1.font.Style+[fsbold]

                 else

                   memo1.Font.Style:=memo1.font.Style-[fsbold]

end;

 

procedure TForm1.italic1Click(Sender: TObject);

begin

italic1.Checked:=not italic1.Checked;

if italic1.Checked then

                   memo1.Font.Style:=memo1.font.Style+[fsitalic]

                 else

                   memo1.Font.Style:=memo1.font.Style-[fsitalic]

end;

 

procedure TForm1.altizili1Click(Sender: TObject);

begin

altizili1.Checked:=not altizili1.Checked;

if altizili1.Checked then

                   memo1.Font.Style:=memo1.font.Style+[fsunderline]

                 else

                   memo1.Font.Style:=memo1.font.Style-[fsunderline]

end;

 

procedure TForm1.sa1Click(Sender: TObject);

begin

sa1.Checked:=not sa1.Checked;

memo1.Alignment:=tarightjustify;

end;

 

procedure TForm1.sol1Click(Sender: TObject);

begin

sol1.Checked:=not sol1.Checked;

memo1.Alignment:=taleftjustify;

end;

 

procedure TForm1.orta1Click(Sender: TObject);

begin

orta1.Checked:=not orta1.Checked;

memo1.Alignment:=tacenter;

end;

 

procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

if speedbutton1.Down then

                     memo1.Font.Style:=memo1.Font.Style+[fsbold]

                     else

                     memo1.Font.Style:=memo1.Font.Style-[fsbold];

 

end;

 

procedure TForm1.SpeedButton2Click(Sender: TObject);

begin

if speedbutton2.Down then

                     memo1.Font.Style:=memo1.Font.Style+[fsitalic]

                     else

                     memo1.Font.Style:=memo1.Font.Style-[fsitalic];

 

end;

 

procedure TForm1.SpeedButton3Click(Sender: TObject);

begin

if speedbutton3.Down then

                     memo1.Font.Style:=memo1.Font.Style+[fsunderline]

                     else

                     memo1.Font.Style:=memo1.Font.Style-[fsunderline];

 

end;

 

procedure TForm1.SpeedButton4Click(Sender: TObject);

begin

memo1.Alignment:=tarightjustify;

end;

 

procedure TForm1.SpeedButton5Click(Sender: TObject);

begin

memo1.Alignment:=tacenter;

 

end;

 

procedure TForm1.SpeedButton6Click(Sender: TObject);

begin

memo1.Alignment:=taleftjustify;

end;

 

procedure TForm1.FormCreate(Sender: TObject);

var

i:byte;

begin

combobox1.Items:=screen.Fonts;

for i:=8 to 30 do

  combobox2.Items.Add(inttostr(i));

 

combobox1.Text:=memo1.Font.Name;

combobox2.Text:=inttostr(memo1.Font.size);

end;

 

procedure TForm1.ComboBox1Change(Sender: TObject);

begin

memo1.Font.Name:=combobox1.Text;

end;

 

procedure TForm1.ComboBox2Change(Sender: TObject);

begin

memo1.Font.Size:=strtoint(combobox2.text);

end;

end.

 

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

 

paint örneği

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,

  Y: Integer);

begin

if a=true then canvas.LineTo(x,y);

end;

 

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

 

canvas.MoveTo(x,y);

x1:=x;

y1:=y;

if combobox1.ItemIndex=0 then a:=true

                          else a:=false;

end;

 

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

a:=false;

if combobox1.ItemIndex=1 then

                            begin

                               if checkbox1.Checked then

                                     begin

                                       canvas.Brush.Style:= bsDiagCross;

                                       canvas.Brush.Color:=dr;

                                      end;

                                  canvas.Rectangle(x1,y1,x,y);

                             end;

end;

 

procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

if colordialog1.Execute then

canvas.Pen.Color:=colordialog1.Color;

end;

 

procedure TForm1.SpinEdit1Change(Sender: TObject);

begin

canvas.Pen.Width:=spinedit1.Value;

end;

 

procedure TForm1.SpeedButton2Click(Sender: TObject);

begin

if colordialog2.Execute then

       dr:=colordialog2.color;

end;

 

procedure TForm1.SpeedButton3Click(Sender: TObject);

begin

canvas.Pen.Color:=clbtnface;

end;

 

end.

 

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

 

mediaplayer

procedure TForm1.Button1Click(Sender: TObject);

begin

if opendialog1.Execute then

 begin

    mediaplayer1.FileName:=opendialog1.FileName;

    mediaplayer1.Open;

    mediaplayer1.Display:=panel1;

    mediaplayer1.DisplayRect:=rect(5,5,panel1.Width-10,panel1.Height-10);

 end;

 

 

end;

 

end.

 

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

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