Senin, 18 Juni 2012

TUGAS

MEDIA PLAYER

listing membuat media player dengan playlist

setelah lama saya mengutak-atik project, googling kesana kemari, akhirnya jadi juga nih projec. Biar di bantu teman juga untuk pengerjaannya
berikut ini adalah listing yang saya mau share kepada pemirsa sekalian

player music dengan playlist

komponen yang saya gunakan adalah :
   "mp: TMediaPlayer;
    Timer1: TTimer;
    pb: TProgressBar;
    od: TOpenDialog;
    Panel1: TPanel;
    bo: TButton;
    bt: TButton;
    GroupBox1: TGroupBox;
    tf: TTimer;
    Panel2: TPanel;
    info: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    Button1: TButton;
    Button2: TButton;
    lb: TListBox;
    GroupBox2: TGroupBox;
    tgl: TLabel;
    jam: TLabel;
    tjam: TTimer;
    Button3: TButton;"

 dan ini adalah listing:
"implementation
uses Math;
{$R *.dfm}

procedure TForm1.boClick(Sender: TObject);
begin
mp.Display:=panel1;
if od.Execute then
begin
lb.Items.Add(od.FileName);
 info.Caption:=od.FileName;
 mp.FileName:=od.FileName;
 mp.Open;
 if lb.ItemIndex > 1 then
 pb.Position:=mp.Position;
 pb.Max:=mp.Length;
 mp.Enabled:=true;
 timer1.Enabled:=true;
 end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
pb.Position:=mp.Position;
end;


procedure TForm1.lbClick(Sender: TObject);
var A:integer;
begin
A:=lb.ItemIndex;

     If lb.Selected[A] Then
        Begin
          info.Caption:=lb.Items.Strings[A];
        End;
end;

procedure TForm1.lbDblClick(Sender: TObject);
Var A:Integer;
begin
A:=lb.ItemIndex;

     If lb.Selected[A] Then
        Begin
          info.Caption:=lb.Items.Strings[A];
          Mp.FileName:=info.Caption;
          Mp.Open;
          Mp.Play;
        End;
end;

procedure TForm1.tjamTimer(Sender: TObject);
begin
jam.Caption:=timetostr(time)
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
tgl.Caption:=formatdatetime('dd-mm-yyyy',date());
end;

function GetWaveVolume(var LVol:DWORD; var RVol:DWORD):Boolean;
var
WaveOutCaps:TWAVEOUTCAPS;
Volume:DWORD;
begin
result:=false;
if WaveOutGetDevCaps(WAVE_MAPPER,@ WaveOutCaps, sizeof(WaveOutCaps))=MMSYSERR_NOERROR then
if WaveOutCaps.dwFormats and WAVECAPS_VOLUME=WAVECAPS_VOLUME then
begin
result:=WaveOutGetVolume(WAVE_MAPPER, @ Volume)=MMSYSERR_NOERROR;
LVol:=LoWord(Volume);
RVol:=HiWord(Volume);
end;
end;

function SetWaveVolume (const AVolume:DWORD):boolean;
var
WaveOutCaps:TWAVEOUTCAPS;
begin
result:=false;
if WaveOutGetDevCaps(WAVE_MAPPER,@ WaveOutCaps, sizeof(WaveOutCaps))=MMSYSERR_NOERROR then
if WaveOutCaps.dwFormats and WAVECAPS_VOLUME=WAVECAPS_VOLUME then
result:=WaveOutSetVolume(WAVE_MAPPER, AVolume)=MMSYSERR_NOERROR;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
LVol:Word;
RVol:Word;
begin
LVol:=spinedit1.Value;
RVol:=spinedit2.Value;
SetWaveVolume(MakeLong(LVol, RVol));
end;

procedure TForm1.Button2Click(Sender: TObject);
var
LVol:DWORD;
RVol:DWORD;
begin
if GetWaveVolume(LVol, RVol)then
begin
spinedit1.Value:=LVol;
spinedit2.Value:=RVol;
end;
end;

procedure TForm1.btClick(Sender: TObject);
begin
close;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
lb.Clear;
end;

end."

di project ini juga bisa buka video juga kok, kalo soal ekstensi kita bisa mengaturnya. tapi disini belom saya atur ekstensinya.
ini screenshoot dari videonya


mungkin di listing ini belom sempurna tapi ilmu yang saya punya cuma segitu aja dan mau googling di yahoo juga males karena gk setiap saat terkoneksi dengan internet.

jika anda bingung dengan penjelasan yang saya berikan, anda bisa mendownloadnya kok.
klik disini jika mau mendownload project saya.

cukup sekian ilmu yang saya share pada hari ini, semoga ilmu yang saya share berguna da bermanfaat bagi orang lain.

Rabu, 04 April 2012

TUGAS ANGGA RUSTANJI DELPI 7

NAMA : ANGGA RUSTANJI
KELAS: 13.6B.01
NIM     : 13090283
LAB     : D
GAMES TIMER




TUGAS LATIHAN MEMBUAT GAMES DENGAN TIMER



unit Lati1;

interface

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

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Image6: TImage;
Label2: TLabel;
Edit2: TEdit;
Label1: TLabel;
Timer1: TTimer;
Edit3: TEdit;
Edit4: TEdit;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
MainMenu1: TMainMenu;
Memo1: TMemo;
File1: TMenuItem;
ExitGames1: TMenuItem;
Help1: TMenuItem;
AboutMe1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button2Click(Sender: TObject);
procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure Image3Click(Sender: TObject);
procedure Image4Click(Sender: TObject);
procedure Image5Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Edit4Change(Sender: TObject);
procedure AboutMe1Click(Sender: TObject);
procedure ExitGames1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Procedure aktif;
Procedure nonaktif;
end;

var
Form1: TForm1;
awal, akhir : TDateTime;
lama : real;


implementation

uses Latihan_Form2;

{$R *.dfm}
Procedure TForm1.aktif;
Begin
Image1.Enabled:=true;
Image2.Enabled:=true;
Image3.Enabled:=true;
Image4.Enabled:=true;
Image5.Enabled:=true;
edit1.Enabled:=true;
image1.Visible:=true;
image2.Visible:=true;
image3.Visible:=true;
image4.Visible:=true;
image5.Visible:=true;
end;


Procedure TForm1.nonaktif;
Begin
Image1.Enabled:=false;
Image2.Enabled:=false;
Image3.Enabled:=false;
Image4.Enabled:=false;
Image5.Enabled:=false;
Edit1.Enabled:=false;

end;
procedure TForm1.FormCreate(Sender: TObject);
begin
nonaktif;
Timer1.Interval:=1;
Memo1.Clear;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
aktif;
if Button1.Caption='Start' then
begin
awal := Time;
Edit2.Text:=TimeToStr(Time);
Button1.Caption:='Stop';
end
else if Button1.Caption='Stop' then
begin
Button1.Caption:='Selesai';
nonaktif;
end
else
Application.Terminate;

end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
image1.Left:=random(Left);
image1.Top:=random(Top);

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

procedure TForm1.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
image2.Left:=random(Left);
image2.Top:=random(Top);
end;

procedure TForm1.Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
image3.Left:=random(Left);
image3.Top:=random(Top);
end;

procedure TForm1.Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
image4.Left:=random(Left);
image4.Top:=random(Top);
end;

procedure TForm1.Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
image5.Left:=random(Left);
image5.Top:=random(Top);
end;

procedure TForm1.Image1Click(Sender: TObject);
begin
image1.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TForm1.Image2Click(Sender: TObject);
begin
image2.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TForm1.Image3Click(Sender: TObject);
begin
image3.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TForm1.Image4Click(Sender: TObject);
begin
image4.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TForm1.Image5Click(Sender: TObject);
begin
image5.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
If Edit1.Text='100' then
begin
nonaktif;
Edit2.Visible:=False;
Edit3.Visible:=False;
Edit4.Visible :=False;
showmessage('Anda Menang (WINER)');

end
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
Slama : string;
begin
if Button1.Caption='Stop' then
begin
akhir := Time;
Edit3.Text:=TimeToStr(akhir);
lama := (akhir-awal)*100000;
Str(lama:20:4,Slama);
Edit4.Text:=Slama;
end
end;


procedure TForm1.Edit4Change(Sender: TObject);
begin
if lama >=100000 then
Begin
Button1.Caption:='Selesai';
showmessage('GAMES OVER : ANDA KALAH >>> BEGO BETUL...??');
end
Else If lama <=100000 then
Begin
If Edit1.Text='100' Then
Begin
nonaktif;
Edit2.Visible:=False;
Edit3.Visible:=False;
Edit4.Visible :=False;
Edit1.ShowHint :=True;
Memo1.Clear;
Memo1.Text:='Anda Menang (Winner) ';
end
end
Else
Form1.Show;

end;

procedure TForm1.AboutMe1Click(Sender: TObject);
begin
Form2.Show;
end;

procedure TForm1.ExitGames1Click(Sender: TObject);
begin
Application.Terminate ;
end;

end.

Sabtu, 24 Maret 2012

TUGAS DELPHI 7 ADVANCED

NAMA : ANGGA RUSTANDJI

KELAS : 13.6B.01

NIM : 13090283

CODING TUGAS <<<<MEMO>>>>>

------------------------------------------------------------------------------------------------------
unit Latihan3;

interface

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

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    CheckBox6: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox8: TCheckBox;
    CheckBox9: TCheckBox;
    CheckBox10: TCheckBox;
    Image1: TImage;
    Label1: TLabel;
    Button1: TButton;
    Memo1: TMemo;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    Exit1: TMenuItem;
    Help1: TMenuItem;
    AboutMe1: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);
    procedure CheckBox6Click(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);
    procedure CheckBox8Click(Sender: TObject);
    procedure CheckBox9Click(Sender: TObject);
    procedure CheckBox10Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
    procedure AboutMe1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Latihan3Form2;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Items:=Screen.Fonts;
ComboBox1.Text:='PILIH FONTS';
ComboBox2.Text:='PILIH UKURAN';
Memo1.Text:='';
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;

procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Memo1.Color:=ClRed;
RadioButton2.Enabled :=False;
RadioButton3.Enabled :=False;
RadioButton4.Enabled :=False;
RadioButton5.Enabled :=False;
end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Memo1.Color:=ClBlue;
RadioButton1.Enabled :=False;
RadioButton3.Enabled :=False;
RadioButton4.Enabled :=False;
RadioButton5.Enabled :=False;
end;

procedure TForm1.RadioButton3Click(Sender: TObject);
begin
Memo1.Color:=ClYellow;
RadioButton1.Enabled :=False;
RadioButton2.Enabled :=False;
RadioButton4.Enabled :=False;
RadioButton5.Enabled :=False;
end;

procedure TForm1.RadioButton4Click(Sender: TObject);
begin
Memo1.Color:=ClGreen;
RadioButton1.Enabled :=False;
RadioButton2.Enabled :=False;
RadioButton3.Enabled :=False;
RadioButton5.Enabled :=False;
end;

procedure TForm1.RadioButton5Click(Sender: TObject);
begin
Memo1.Color:=ClGray;
RadioButton1.Enabled :=False;
RadioButton2.Enabled :=False;
RadioButton3.Enabled :=False;
RadioButton4.Enabled :=False;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
If CheckBox1.Checked=True then
   Begin
   Memo1.Font.Style :=Memo1.Font.Style+[FsBold];
   CheckBox1.Caption:='Un Bold';
   End
 Else
 Begin
  CheckBox1.Caption:='Bold';
  Memo1.Font.Style := Memo1.Font.Style-[FsBold];
 End

end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin
If CheckBox2.Checked=True then
   Begin
   Memo1.Font.Style :=Memo1.Font.Style+[FsItalic];
   CheckBox2.Caption:='Un Italic';
   End
 Else
 Begin
  CheckBox2.Caption:='Italic';
  Memo1.Font.Style := Memo1.Font.Style-[FsItalic];
 End
end;

procedure TForm1.CheckBox3Click(Sender: TObject);
begin
If CheckBox3.Checked=True then
   Begin
   Memo1.Font.Style :=Memo1.Font.Style+[FsUnderline];
   CheckBox3.Caption:='Non Line';
   End
 Else
 Begin
  CheckBox3.Caption:='Underline';
  Memo1.Font.Style := Memo1.Font.Style-[FsUnderline];
 End
end;

procedure TForm1.CheckBox4Click(Sender: TObject);
begin
If CheckBox4.Checked=True then
   Begin
   Memo1.Font.Style :=Memo1.Font.Style+[FsStrikeOut];
   CheckBox4.Caption:='Un StrikeOut';
   End
 Else
 Begin
  CheckBox4.Caption:='StrikeOut';
  Memo1.Font.Style := Memo1.Font.Style-[FsStrikeOut];
 End
end;


procedure TForm1.CheckBox6Click(Sender: TObject);
begin
If CheckBox6.Checked=True then
   Begin
   Memo1.Font.Color:=ClRed;
   End
 Else
 Begin
  Memo1.Font.Color:= ClBlack;
 End
end;

procedure TForm1.CheckBox7Click(Sender: TObject);
begin
If CheckBox7.Checked=True then
   Begin
   Memo1.Font.Color:=ClBlue;
   End
 Else
 Begin
  Memo1.Font.Color:= ClBlack;
 End
end;

procedure TForm1.CheckBox8Click(Sender: TObject);
begin
If CheckBox8.Checked=True then
   Begin
   Memo1.Font.Color:=ClYellow;
   End
 Else
 Begin
  Memo1.Font.Color:= ClBlack;
 End
end;

procedure TForm1.CheckBox9Click(Sender: TObject);
begin
If CheckBox9.Checked=True then
   Begin
   Memo1.Font.Color:=ClGreen;
   End
 Else
 Begin
  Memo1.Font.Color:= ClBlack;
 End
end;

procedure TForm1.CheckBox10Click(Sender: TObject);
begin
If CheckBox10.Checked=True then
   Begin
   Memo1.Font.Color:=ClGray;
   End
 Else
 Begin
  Memo1.Font.Color:= ClBlack;
 End
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Color:=ClWindow;
RadioButton1.Enabled :=True;
RadioButton2.Enabled :=True;
RadioButton3.Enabled :=True;
RadioButton4.Enabled :=True;
RadioButton5.Enabled :=True;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
Form1.Action;
Memo1.SetFocus;
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm1.AboutMe1Click(Sender: TObject);
begin
Form2.Show;
end;

end.





Screen Shut Program <<>>>