Kullanıcı

Hoşgeldiniz Ziyaretçi. Lütfen giriş yapın veya kayıt olun.
E-posta adresinize aktivasyon iletisi gelmediyse lütfen buraya tıklayın.
10 Eylül 2010 10:51:27

Kullanıcı adınızı, şifrenizi ve aktif kalma süresini giriniz

Sohbet Penceresi

Son 5 Notlar:

27 AÄŸustos 2010 10:00:56
arkadaşlar delphi ile fax nasıl gönderilir şeklinde konuya cevaplarınızı bekliyorum...
  XLG
01 Eylül 2010 17:00:37
arkdaÅŸlar admin kim ya
  XLG
01 Eylül 2010 17:00:55
bi maruzatım olacak ta
03 Eylül 2010 11:14:44
Arkadaşlar SUBHAN adlı arkadaşımızdan haberi olan var mı? Bir yıldır hiç siteye girmemiş? Sitesi de borçtan kapanmış. Başına bir şey mi geldi?
06 Eylül 2010 16:29:36
subhan programlamayı bıraktı diye biliyorum :)

Show 50 latest

Gönderen Konu: her zaman farklı isimle kaydetmek  (Okunma sayısı 268 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı tdoktoru

  • Üye
  • ***
  • İleti: 42
  • Rep: +0/-0
her zaman farklı isimle kaydetmek
« : 30 Haziran 2009 11:00:33 »
merhaba arkadaslar ben button1 e her tıkladıgımda c:\ dizinine otomatik deneme[1].jpg, deneme[2].jpg, deneme[3].jpg atmasını nasıl saglayabilirim.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, ExtDlgs,jpeg;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    save: TSavePictureDialog;
    procedure Button1Click(Sender: TObject);
 procedure BmpDenJpgye(bmpyolu:string;jpgyolu:string);   
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure Tform1.BmpDenJpgye(bmpyolu:string;jpgyolu:string);
var
  JpegImg: TJpegImage;
  Bitmap: TBitmap;
begin
  Bitmap := TBitmap.Create;
  try
   Bitmap.LoadFromFile(bmpyolu) ;
   JpegImg := TJpegImage.Create;
   try
    JpegImg.Assign(Bitmap) ;
    JpegImg.SaveToFile(jpgyolu) ;
    finally
    JpegImg.Free
   end;
  finally
   Bitmap.Free
  end;
end;

// 1. Get the handle to the current mouse-cursor and its position
function GetCursorInfo2: TCursorInfo;
var
 hWindow: HWND;
 pt: TPoint;
 pIconInfo: TIconInfo;
 dwThreadID, dwCurrentThreadID: DWORD;
begin
 Result.hCursor := 0;
 ZeroMemory(@Result, SizeOf(Result));
 // Find out which window owns the cursor
 if GetCursorPos(pt) then
 begin
   Result.ptScreenPos := pt;
   hWindow := WindowFromPoint(pt);
   if IsWindow(hWindow) then
   begin
     // Get the thread ID for the cursor owner.
     dwThreadID := GetWindowThreadProcessId(hWindow, nil);

     // Get the thread ID for the current thread
     dwCurrentThreadID := GetCurrentThreadId;

     // If the cursor owner is not us then we must attach to
     // the other thread in so that we can use GetCursor() to
     // return the correct hCursor
     if (dwCurrentThreadID <> dwThreadID) then
     begin
       if AttachThreadInput(dwCurrentThreadID, dwThreadID, True) then
       begin
         // Get the handle to the cursor
         Result.hCursor := GetCursor;
         AttachThreadInput(dwCurrentThreadID, dwThreadID, False);
       end;
     end
     else
     begin
       Result.hCursor := GetCursor;
     end;
   end;
 end;
end;

// 2. Capture the screen
function CaptureScreen: TBitmap;
var
 DC: HDC;
 ABitmap: TBitmap;
 MyCursor: TIcon;
 CursorInfo: TCursorInfo;
 IconInfo: TIconInfo;
begin
 // Capture the Desktop screen
 DC := GetDC(GetDesktopWindow);
 ABitmap := TBitmap.Create;
 try
   ABitmap.Width  := GetDeviceCaps(DC, HORZRES);
   ABitmap.Height := GetDeviceCaps(DC, VERTRES);
   // BitBlt on our bitmap
   BitBlt(ABitmap.Canvas.Handle,
     0,
     0,
     ABitmap.Width,
     ABitmap.Height,
     DC,
     0,
     0,
     SRCCOPY);
   // Create temp. Icon
   MyCursor := TIcon.Create;
   try
     // Retrieve Cursor info
     CursorInfo := GetCursorInfo2;
     if CursorInfo.hCursor <> 0 then
     begin
       MyCursor.Handle := CursorInfo.hCursor;
       // Get Hotspot information
       GetIconInfo(CursorInfo.hCursor, IconInfo);
       // Draw the Cursor on our bitmap
       ABitmap.Canvas.Draw(CursorInfo.ptScreenPos.X - IconInfo.xHotspot,
                           CursorInfo.ptScreenPos.Y - IconInfo.yHotspot, MyCursor);
     end;
   finally
     // Clean up
     MyCursor.ReleaseHandle;
     MyCursor.Free;
   end;
 finally
   ReleaseDC(GetDesktopWindow, DC);
 end;
 Result := ABitmap;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  Image1.Picture.Assign(CaptureScreen);
//  image1.Picture.SaveToFile('C:\deneme.bmp');
  BmpDenJpgye('C:\deneme.bmp','C:\deneme.jpg');//Bmden Jpye çeviriyorum
  // ben her tıkladıgımda otomatik deneme[1].jpg, deneme[2].jpg, deneme[3].jpg olarak
  // aktarmasını istiyorum
  end;
end.

Çevrimdışı barutali

  • Global Moderatör
  • *****
  • İleti: 1.349
  • Rep: +38/-0
  • Cinsiyet: Bay
  • Falan filan ...
Ynt: her zaman farklı isimle kaydetmek
« Yanıtla #1 : 30 Haziran 2009 11:49:27 »
Kod: (delphi) [Seç]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,jpeg, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }

   arttir : integer;  // eklendii

    procedure BmpDenJpgye(bmpyolu:string;jpgyolu:string);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure Tform1.BmpDenJpgye(bmpyolu:string;jpgyolu:string);
var
  JpegImg: TJpegImage;
  Bitmap: TBitmap;
begin
  Bitmap := TBitmap.Create;
  try
   Bitmap.LoadFromFile(bmpyolu) ;
   JpegImg := TJpegImage.Create;
   try
    JpegImg.Assign(Bitmap) ;
    JpegImg.SaveToFile(jpgyolu) ;
    finally
    JpegImg.Free
   end;
  finally
   Bitmap.Free
  end;
end;

function GetCursorInfo2: TCursorInfo;
var
 hWindow: HWND;
 pt: TPoint;
 pIconInfo: TIconInfo;
 dwThreadID, dwCurrentThreadID: DWORD;
begin
 Result.hCursor := 0;
 ZeroMemory(@Result, SizeOf(Result));
 // Find out which window owns the cursor
 if GetCursorPos(pt) then
 begin
   Result.ptScreenPos := pt;
   hWindow := WindowFromPoint(pt);
   if IsWindow(hWindow) then
   begin
     // Get the thread ID for the cursor owner.
     dwThreadID := GetWindowThreadProcessId(hWindow, nil);

     // Get the thread ID for the current thread
     dwCurrentThreadID := GetCurrentThreadId;

     // If the cursor owner is not us then we must attach to
     // the other thread in so that we can use GetCursor() to
     // return the correct hCursor
     if (dwCurrentThreadID <> dwThreadID) then
     begin
       if AttachThreadInput(dwCurrentThreadID, dwThreadID, True) then
       begin
         // Get the handle to the cursor
         Result.hCursor := GetCursor;
         AttachThreadInput(dwCurrentThreadID, dwThreadID, False);
       end;
     end
     else
     begin
       Result.hCursor := GetCursor;
     end;
   end;
 end;
end;

// 2. Capture the screen
function CaptureScreen: TBitmap;
var
 DC: HDC;
 ABitmap: TBitmap;
 MyCursor: TIcon;
 CursorInfo: TCursorInfo;
 IconInfo: TIconInfo;
begin
 // Capture the Desktop screen
 DC := GetDC(GetDesktopWindow);
 ABitmap := TBitmap.Create;
 try
   ABitmap.Width  := GetDeviceCaps(DC, HORZRES);
   ABitmap.Height := GetDeviceCaps(DC, VERTRES);
   // BitBlt on our bitmap
   BitBlt(ABitmap.Canvas.Handle,
     0,
     0,
     ABitmap.Width,
     ABitmap.Height,
     DC,
     0,
     0,
     SRCCOPY);
   // Create temp. Icon
   MyCursor := TIcon.Create;
   try
     // Retrieve Cursor info
     CursorInfo := GetCursorInfo2;
     if CursorInfo.hCursor <> 0 then
     begin
       MyCursor.Handle := CursorInfo.hCursor;
       // Get Hotspot information
       GetIconInfo(CursorInfo.hCursor, IconInfo);
       // Draw the Cursor on our bitmap
       ABitmap.Canvas.Draw(CursorInfo.ptScreenPos.X - IconInfo.xHotspot,
                           CursorInfo.ptScreenPos.Y - IconInfo.yHotspot, MyCursor);
     end;
   finally
     // Clean up
     MyCursor.ReleaseHandle;
     MyCursor.Free;
   end;
 finally
   ReleaseDC(GetDesktopWindow, DC);
 end;
 Result := ABitmap;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
Inc(arttir);   // eklendii
Image1.Picture.Assign(CaptureScreen);
BmpDenJpgye('C:\deneme.bmp',format('C:\deneme%d.jpg',[arttir])); // deÄŸiÅŸtirildi

end;


end.



 buyur arkadaşım yukarıdaki kodları kullan istediÄŸin gibi +1 olarak arttırıp kaydediyor...

deÄŸiÅŸen ve eklenen yerleri belirttim
kolay gelsin...
En İyi Öğrenme Metodu Yaparak ve Yaşayaraktır.
M.Kemal ATATÜRK

Çevrimdışı tdoktoru

  • Üye
  • ***
  • İleti: 42
  • Rep: +0/-0
Ynt: her zaman farklı isimle kaydetmek
« Yanıtla #2 : 30 Haziran 2009 11:51:02 »
teşekkür ederim Allah razı olsun

Çevrimdışı barutali

  • Global Moderatör
  • *****
  • İleti: 1.349
  • Rep: +38/-0
  • Cinsiyet: Bay
  • Falan filan ...
Ynt: her zaman farklı isimle kaydetmek
« Yanıtla #3 : 30 Haziran 2009 11:51:52 »
Sendende Allah razı olsun kardeşim..
En İyi Öğrenme Metodu Yaparak ve Yaşayaraktır.
M.Kemal ATATÜRK