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

Thread Örneği

Don't freeze your program.

If your main thread goes in a loop, your application will be frozen.

What if the user want to cancel the running activity?

So make it a thread and make the termination of the loop depend on the value of a variable (FCanceled in this tip) which can be modified by the user (with Button2 in this tip).

When the user click on Button2, FCanceled becomes False and the thread's loop ends.

 

During the loop, you can right click the title bar to show the system menu, you can drag the form, and all other things without pausing the loop.

 

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

unit Unit1;

 

interface

 

uses

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

 Dialogs, StdCtrls;

 

type

 TForm1 = class(TForm)

   Button1: TButton;

   Edit1: TEdit;

   Button2: TButton;

   procedure FormCreate(Sender: TObject);

   procedure Button1Click(Sender: TObject);

   procedure Button2Click(Sender: TObject);

 private

   { Private declarations }

   FCanceled: Boolean;

 public

   { Public declarations }

 end;

 

 TThread1 = class(TThread)

 protected

   constructor Create;

   procedure Execute; override;

   procedure IncreaseNumber;

 end;

var

 Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

 Self.Caption := 'You May Cancel a Loop';

 Edit1.Text := '1';

 Edit1.ReadOnly := True;

 Button1.Caption := 'Start';

 Button2.Caption := 'Stop';

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

 FCanceled := False; TThread1.Create;

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

 FCanceled := True;

end;

 

constructor TThread1.Create;

begin

 inherited Create(false);

end;

 

procedure TThread1.Execute;

var success: Boolean;

begin

 Self.Priority := tpLowest;

 with Form1 do

 begin

   while not FCanceled do

   begin

     // call Synchronize so that you can create more threads by clicking

     // the Start button and all created threads can run synchronously

     Synchronize(IncreaseNumber);

   end;

 end;

end;

 

procedure TThread1.IncreaseNumber;

begin

 with Form1 do

   Edit1.Text := IntToStr(Succ(StrToInt(Edit1.Text)));

end;

 

end.

 

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

 

hızlı ve temiz programlar

procedure showform;

 

Implemention

 

procedure showform;

with TFormName.Create(Application) do

 try

   ShowModal;

 finally

   Free;

 end;

(*

Call Form :

Unit1.ShowForm; //Use unit name.

 

Cause of this, less memory is used ,because the

form is stored in the application and having them#

pre-created takes the form into primary memory.

 

So just remove it from the dpr file.

 

Compress it with upx or somthing.

Because the smaller the file, the less space it use's

on primary memory which allows you cpu to process apps faster.

 

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

 

hızlı ve temiz programlar

procedure showform;

 

Implemention

 

procedure showform;

with TFormName.Create(Application) do

 try

   ShowModal;

 finally

   Free;

 end;

(*

Call Form :

Unit1.ShowForm; //Use unit name.

 

Cause of this, less memory is used ,because the

form is stored in the application and having them#

pre-created takes the form into primary memory.

 

So just remove it from the dpr file.

 

Compress it with upx or somthing.

Because the smaller the file, the less space it use's

on primary memory which allows you cpu to process apps faster.

 

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

 

System Tray cleaning

This tip was posted to Borland newsgroups

by Erik Turner.

 

procedure RemoveDeadIcons;

var

 TrayWindow : HWnd;

 WindowRect : TRect;

 SmallIconWidth : Integer;

 SmallIconHeight : Integer;

 CursorPos : TPoint;

 Row : Integer;

 Col : Integer;

begin

 { Get tray window handle and bounding rectangle }

 TrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd',NIL),0,'TrayNotifyWnd',NIL);

 if not GetWindowRect(TrayWindow,WindowRect) then

   Exit;

 { Get small icon metrics }

 SmallIconWidth := GetSystemMetrics(SM_CXSMICON);

 SmallIconHeight := GetSystemMetrics(SM_CYSMICON);

 { Save current mouse position }

 GetCursorPos(CursorPos);

 { Sweep the mouse cursor over each icon in the tray in both dimensions }

 with WindowRect do

 begin

   for Row := 0 to (Bottom - Top) DIV SmallIconHeight do

   begin

     for Col := 0 to (Right - Left) DIV SmallIconWidth do

     begin

       SetCursorPos(Left + Col * SmallIconWidth, Top + Row * SmallIconHeight);

       Sleep(0);

     end;

   end;

 end;

 { Restore mouse position }

 SetCursorPos(CursorPos.X,CursorPos.Y);

 { Redraw tray window (to fix bug in multi-line tray area) }

 RedrawWindow(TrayWindow,NIL,0,RDW_INVALIDATE OR RDW_ERASE OR RDW_UPDATENOW);

end;

 

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

 

System Tray cleaning

This tip was posted to Borland newsgroups

by Erik Turner.

 

procedure RemoveDeadIcons;

var

 TrayWindow : HWnd;

 WindowRect : TRect;

 SmallIconWidth : Integer;

 SmallIconHeight : Integer;

 CursorPos : TPoint;

 Row : Integer;

 Col : Integer;

begin

 { Get tray window handle and bounding rectangle }

 TrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd',NIL),0,'TrayNotifyWnd',NIL);

 if not GetWindowRect(TrayWindow,WindowRect) then

   Exit;

 { Get small icon metrics }

 SmallIconWidth := GetSystemMetrics(SM_CXSMICON);

 SmallIconHeight := GetSystemMetrics(SM_CYSMICON);

 { Save current mouse position }

 GetCursorPos(CursorPos);

 { Sweep the mouse cursor over each icon in the tray in both dimensions }

 with WindowRect do

 begin

   for Row := 0 to (Bottom - Top) DIV SmallIconHeight do

   begin

     for Col := 0 to (Right - Left) DIV SmallIconWidth do

     begin

       SetCursorPos(Left + Col * SmallIconWidth, Top + Row * SmallIconHeight);

       Sleep(0);

     end;

   end;

 end;

 { Restore mouse position }

 SetCursorPos(CursorPos.X,CursorPos.Y);

 { Redraw tray window (to fix bug in multi-line tray area) }

 RedrawWindow(TrayWindow,NIL,0,RDW_INVALIDATE OR RDW_ERASE OR RDW_UPDATENOW);

end;

 

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

 

Mouse to RBG

http://www.dancemammal.com/

Description: How to get the RGB value of a pixel under the mouse cursor

Author: Delphi Pool

Function Style: Graphics

Source Code:

 

 

procedure TForm1.ImageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

begin

  ColNumb := Image.Canvas.Pixels[X, Y];  {The image can't be a JPG}

  GetRGB(ColNumb, R, G, B);

  {Here are the RGB values you need}

end;

 

 

The GetRGB procedure:

 

 

procedure GetRGB(Col: TColor; var R, G, B: Byte);

var

  Color: $0..$FFFFFFFF;

begin

  Color := ColorToRGB(Col);

  R := ($000000FF and Color);

  G := ($0000FF00 and Color) Shr 8;

  B := ($00FF0000 and Color) Shr 16;

end;

 

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

 

Mouse to RBG

http://www.dancemammal.com/

Description: How to get the RGB value of a pixel under the mouse cursor

Author: Delphi Pool

Function Style: Graphics

Source Code:

 

 

procedure TForm1.ImageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

begin

  ColNumb := Image.Canvas.Pixels[X, Y];  {The image can't be a JPG}

  GetRGB(ColNumb, R, G, B);

  {Here are the RGB values you need}

end;

 

 

The GetRGB procedure:

 

 

procedure GetRGB(Col: TColor; var R, G, B: Byte);

var

  Color: $0..$FFFFFFFF;

begin

  Color := ColorToRGB(Col);

  R := ($000000FF and Color);

  G := ($0000FF00 and Color) Shr 8;

  B := ($00FF0000 and Color) Shr 16;

end;

 

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

 

Meta Join

http://www.dancemammal.com/

Description: How to join two TMetaFile

Author: Delphi Pool

Function Style: Graphics

Source Code:

{ ... }

  MetaFile1 := TMetaFile.Create;

  MetaFile2 := TMetaFile.Create;

  DestMetaFile := TMetaFile.Create;

  try

    MetaFile1.LoadFromFile('A0000259.WMF');

    MetaFile2.LoadFromFile('A0000260.WMF');

    DestMetaFile.Width := Max(MetaFile1.Width, MetaFile2.Width);

    DestMetaFile.Height := MetaFile1.Height + MetaFile2.Height;

    MetaFileCanvas := TMetaFileCanvas.Create (DestMetaFile, 0);

    try

      MetaFileCanvas.Draw (0, 0, MetaFile1);

      MetaFileCanvas.Draw (0, MetaFile1.Height, MetaFile2);

    finally

      MetaFileCanvas.Free;

    end;

    DestMetaFile.SaveToFile('new.wmf');

  finally

    MetaFile1.Free;

    MetaFile2.Free;

    DestMetaFile.Free;

  end;

{ ... }

 

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

 

Meta Join

http://www.dancemammal.com/

Description: How to join two TMetaFile

Author: Delphi Pool

Function Style: Graphics

Source Code:

{ ... }

  MetaFile1 := TMetaFile.Create;

  MetaFile2 := TMetaFile.Create;

  DestMetaFile := TMetaFile.Create;

  try

    MetaFile1.LoadFromFile('A0000259.WMF');

    MetaFile2.LoadFromFile('A0000260.WMF');

    DestMetaFile.Width := Max(MetaFile1.Width, MetaFile2.Width);

    DestMetaFile.Height := MetaFile1.Height + MetaFile2.Height;

    MetaFileCanvas := TMetaFileCanvas.Create (DestMetaFile, 0);

    try

      MetaFileCanvas.Draw (0, 0, MetaFile1);

      MetaFileCanvas.Draw (0, MetaFile1.Height, MetaFile2);

    finally

      MetaFileCanvas.Free;

    end;

    DestMetaFile.SaveToFile('new.wmf');

  finally

    MetaFile1.Free;

    MetaFile2.Free;

    DestMetaFile.Free;

  end;

{ ... }

 

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

 

Spray

http://www.dancemammal.com/

Description: Draw spray effect on canvas

Author: Tokter

Function Style: Graphics

Source Code:

procedure Spray(Canvas: TCanvas; x, y, r: Integer; Color: TColor);

var

  rad, a: Single;

  i: Integer;

begin

  for i := 0 to 100 do

  begin

    a   := Random * 2 * pi;

    rad := Random * r;

    Canvas.Pixels[x + Round(rad * Cos(a)), y + Round(rad * Sin(a))] := Color;

  end;

end;

 

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

  Y: Integer);

begin

  if ssLeft in Shift then Spray(Image1.Canvas, x, y, 40, clRed);

end;

 

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

  Shift: TShiftState; X, Y: Integer);

begin

  if ssLeft in Shift then Spray(Image1.Canvas, x, y, 40, clRed);

end;

 

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

 

Spray

http://www.dancemammal.com/

Description: Draw spray effect on canvas

Author: Tokter

Function Style: Graphics

Source Code:

procedure Spray(Canvas: TCanvas; x, y, r: Integer; Color: TColor);

var

  rad, a: Single;

  i: Integer;

begin

  for i := 0 to 100 do

  begin

    a   := Random * 2 * pi;

    rad := Random * r;

    Canvas.Pixels[x + Round(rad * Cos(a)), y + Round(rad * Sin(a))] := Color;

  end;

end;

 

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

  Y: Integer);

begin

  if ssLeft in Shift then Spray(Image1.Canvas, x, y, 40, clRed);

end;

 

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

  Shift: TShiftState; X, Y: Integer);

begin

  if ssLeft in Shift then Spray(Image1.Canvas, x, y, 40, clRed);

end;

 

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

 

_-**-_YARDIM_-**-_CEVAP

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

               DATA YOLUNU YANLIŞ OLARAK TANIMLAMIŞSINDIR BİRDE

               PROGRAMLARI KUR HALİNE GETİRMEN GEREK. VEYA GETİRMEZ İSEN

               ÇALIŞMASIN İSTEDİĞİN BİLGİSAYARDA DELPHİ PROGRAMLAMA DİLİNİN KURULU OLMASI GEREKİYOR.

 

 

               KOLAY GELSİN BİR ARA BENDE YAŞADIM ANNI SORUNU .. SORULARINI VE YARDIM İSTEKLERİNİ DELPHİ FORMA YAZARSAN DAHA FAZLA BİLGİ ALIRSIN.

 

               FİKRET_SA@YAHOO.COM

 

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

 

_-**-_YARDIM_-**-_CEVAP

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

               DATA YOLUNU YANLIŞ OLARAK TANIMLAMIŞSINDIR BİRDE

               PROGRAMLARI KUR HALİNE GETİRMEN GEREK. VEYA GETİRMEZ İSEN

               ÇALIŞMASIN İSTEDİĞİN BİLGİSAYARDA DELPHİ PROGRAMLAMA DİLİNİN KURULU OLMASI GEREKİYOR.

 

 

               KOLAY GELSİN BİR ARA BENDE YAŞADIM ANNI SORUNU .. SORULARINI VE YARDIM İSTEKLERİNİ DELPHİ FORMA YAZARSAN DAHA FAZLA BİLGİ ALIRSIN.

 

               FİKRET_SA@YAHOO.COM

 

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

 

_-**-_YARDIM_-**-_CEVAP

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

               DATA YOLUNU YANLIŞ OLARAK TANIMLAMIŞSINDIR BİRDE

               PROGRAMLARI KUR HALİNE GETİRMEN GEREK. VEYA GETİRMEZ İSEN

               ÇALIŞMASIN İSTEDİĞİN BİLGİSAYARDA DELPHİ PROGRAMLAMA DİLİNİN KURULU OLMASI GEREKİYOR.

 

 

               KOLAY GELSİN BİR ARA BENDE YAŞADIM ANNI SORUNU .. SORULARINI VE YARDIM İSTEKLERİNİ DELPHİ FORMA YAZARSAN DAHA FAZLA BİLGİ ALIRSIN.

 

               FİKRET_SA@YAHOO.COM

 

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

 

_-**-_YARDIM_-**-_CEVAP

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

               DATA YOLUNU YANLIŞ OLARAK TANIMLAMIŞSINDIR BİRDE

               PROGRAMLARI KUR HALİNE GETİRMEN GEREK. VEYA GETİRMEZ İSEN

               ÇALIŞMASIN İSTEDİĞİN BİLGİSAYARDA DELPHİ PROGRAMLAMA DİLİNİN KURULU OLMASI GEREKİYOR.

 

 

               KOLAY GELSİN BİR ARA BENDE YAŞADIM ANNI SORUNU .. SORULARINI VE YARDIM İSTEKLERİNİ DELPHİ FORMA YAZARSAN DAHA FAZLA BİLGİ ALIRSIN.

 

               FİKRET_SA@YAHOO.COM

 

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

 

_-**-_YARDIM_-**-_

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

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

 

_-**-_YARDIM_-**-_

slm arkadslar   acil yardımınıza ihtiyacım var

               delphide  yaptıgım  program  başka pc de  çalışmıyor          acaba  nede       data  db  yaptım  parodox  galibaa

 

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

 

txt dosyasına yazma

#include <stdio.h>

 

FILE *d_i;

AnsiString SATIR;

 

if((d_i=fopen("C:deneme.TXT","w"))==NULL)  return ;

 

 SATIR="YAZDIRILACAK METİN";

 fprintf(d_i,"%sn",SATIR.c_str());

 fclose(d_i);

 

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

 

txt dosyasına yazma

#include <stdio.h>

 

FILE *d_i;

AnsiString SATIR;

 

if((d_i=fopen("C:deneme.TXT","w"))==NULL)  return ;

 

 SATIR="YAZDIRILACAK METİN";

 fprintf(d_i,"%sn",SATIR.c_str());

 fclose(d_i);

 

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

 

DBGrid to Excel

procedure gy_DBGrid_to_excel(pdbgrid:TDBGrid; pFile:string;pQu:TQuery);

var vlst1,vlst : TStringList;

    vPath,s : string;

    i : integer;

begin

  vlst1 := TStringList.Create;

  vlst := TStringList.Create;

  s := ";

  for i:=0 to pdbgrid.Columns.Count -1 do begin

    vlst.Add(IntToStr(pQu.FieldByName(pdbgrid.Columns[i].FieldName).index));

    if s <>" then s := s + ';';

    s := s+pdbgrid.Columns[i].Title.Caption;

  end;

  vLst1.Add(s);

  pQu.First;

  s := ";

  while not pQu.Eof do begin

    s := ";

    for i:=0 to vlst.count -1 do begin

      if s <>" then s := s + ';';

      s := s +pQu.Fields[StrToInt(vlst.Strings[i])].AsString;

    end;

    vLst1.Add(s);

    pQu.Next;

  end;

  vPath := 'c:koalatemp';

  gy_Create_Dir(vPath);

  vLst1.SaveToFile(vPath+'koala.csv');

  gy_uyari_mesaji('Uyari', vPath+'koala.csv dosyasi yaratildi.'+chr(13)+' Sütün Ayiraci ; kullanildi',MB_OK);

  s := gy_register_oku(false,'softwareclassesapplicationsexcel.exeshellopencommand',");

  if s=" then

     s := gy_register_oku(false,'softwareclassesexcel.csvshellopencommand',");

  gy_calistir(1,s+' '+vPath+'koala.csv');

end;

 

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

 

DBGrid to Excel

procedure gy_DBGrid_to_excel(pdbgrid:TDBGrid; pFile:string;pQu:TQuery);

var vlst1,vlst : TStringList;

    vPath,s : string;

    i : integer;

begin

  vlst1 := TStringList.Create;

  vlst := TStringList.Create;

  s := ";

  for i:=0 to pdbgrid.Columns.Count -1 do begin

    vlst.Add(IntToStr(pQu.FieldByName(pdbgrid.Columns[i].FieldName).index));

    if s <>" then s := s + ';';

    s := s+pdbgrid.Columns[i].Title.Caption;

  end;

  vLst1.Add(s);

  pQu.First;

  s := ";

  while not pQu.Eof do begin

    s := ";

    for i:=0 to vlst.count -1 do begin

      if s <>" then s := s + ';';

      s := s +pQu.Fields[StrToInt(vlst.Strings[i])].AsString;

    end;

    vLst1.Add(s);

    pQu.Next;

  end;

  vPath := 'c:koalatemp';

  gy_Create_Dir(vPath);

  vLst1.SaveToFile(vPath+'koala.csv');

  gy_uyari_mesaji('Uyari', vPath+'koala.csv dosyasi yaratildi.'+chr(13)+' Sütün Ayiraci ; kullanildi',MB_OK);

  s := gy_register_oku(false,'softwareclassesapplicationsexcel.exeshellopencommand',");

  if s=" then

     s := gy_register_oku(false,'softwareclassesexcel.csvshellopencommand',");

  gy_calistir(1,s+' '+vPath+'koala.csv');

end;

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