|
Menampilkan jam pada title Bar |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
type TForm1 = class(TForm) Timer1: TTimer; Label1: TLabel; Button1: TButton; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; dc: hDC;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject); var TheTime: array[0..80] of char; begin StrPCopy(TheTime, TimeToStr(time)); TextOut(dc, width DIV 2, 5, TheTime, StrLen(TheTime)); end;
|
|
Read more...
|
|
Mengetahui jumlah File dalam forlder dengan delphi |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
function GetFilesCount(Folder, WildCard: string): Integer; var intFound: Integer; SearchRec: TSearchRec; begin Result := 0; if (Folder <> '') and (Folder[Length(Folder)] <> '\') then Folder := Folder + '\';
|
|
Read more...
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject); var Ikon : TIcon; Bitmap : TBitmap; begin Ikon:=TIcon.create; Bitmap:=TBitmap.create; Ikon.LoadFromFile('C:\Data\Iconku.ico'); Bitmap.Height := Ikon.Height;
|
|
Read more...
|
|
Mengetahui URL dari Browser dengan delphi |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Label1: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}
uses ddeman;
procedure TForm1.Button1Click(Sender: TObject); const sName = 'Name'; sURL = 'URL'; var DDEClient : TDDEClientConv; s : string; begin s := ''; try DDEClient := TDDEClientConv.Create(self); try with DDEClient do
|
|
Read more...
|
|
Menghapus File ke Recycle Bin |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
uses ShellApi;
procedure TForm1.Button1Click(Sender: TObject); var FileOpStruc: TSHFileOpStruct; s: PChar; begin s := 'C:\coba.txt';
|
|
Read more...
|
|
Mencari tipe drive dengan delphi |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject); var typ:Integer; s : string; begin s := 'C:\'; typ := GetDriveType(PChar(s)); if Typ <> 0 then case typ of DRIVE_REMOVABLE: begin ShowMessage('Drive Removable / Diskette'); end;
|
|
Read more...
|
|
Memformat Dirive A dengan delphi |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
const SHFMT_DRV_A = 0; const SHFMT_DRV_B = 1; const SHFMT_ID_DEFAULT = $FFFF; const SHFMT_OPT_QUICKFORMAT = 0; const SHFMT_OPT_FULLFORMAT = 1; const SHFMT_OPT_SYSONLY = 2; const SHFMT_ERROR = -1; const SHFMT_CANCEL = -2; const SHFMT_NOFORMAT = -3;
var Form1: TForm1;
implementation
{$R *.dfm}
uses ShellAPI;
function SHFormatDrive(hWnd : HWND; Drive : Word; fmtID : Word; Options : Word) : Longint stdcall; external 'Shell32.dll' name 'SHFormatDrive';
procedure TForm1.Button1Click(Sender: TObject); var FmtRes : longint; begin try FmtRes:= ShFormatDrive(Handle, SHFMT_DRV_A,
|
|
Read more...
|
|
|