MSFN Forum: WavEar - Borland Delphi -True Believers - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

WavEar - Borland Delphi -True Believers Quick Wav browser / player & code Rate Topic: -----

#1 User is offline   Press any key 

  • :Boldly Going Nowhere:.
  • PipPip
  • Group: Members
  • Posts: 210
  • Joined: 24-May 05

  Posted 08 September 2005 - 11:53 AM


<<Borland Delphi>>> :hello: Hello to the True Believers...

Here is a little program I assembled in Borland Delphi for Win32 some years ago.
I think it might have been D4 or D5, but not sure. So, when the new Delphi 2005
became available for personal use on a recent PC Mag. cover disk, so I thought I'd
update this useful (to me) program.

Let me say I do not know anything about programming! The only thing I can
do is drop a button on a Form and fire the 'on click' event by typing the code: Close;

No, this code originally came from a PC Mag. with the message pop-up addition I
obtained from all the FREE Delphi code floating around the Net.

Would not compile with the original message pop-up::..

 procedure TMainForm.SpeedButton1_helpClick(Sender: TObject);
begin
   Application.messagebox(
'1. You can click any Wav sound to play'+#10+
''+#10+
'2. You can click a sound to play, then use the '+#10+
'Keyboard = UP = and = DOWN = Arrows to move '+#10+
'up and down - playing sounds'+#10+
''+#10+
'3. Use the left Folder box to click and find new '+#10+
'Folders with Wav Sound Files in them'+#10+
'____________________'+#10+
''+#10+
'WavEar - Freeware',
mb_Ok+mb_IconAsterisk);
end;


Anyway, I found some other code and whacked it in.

*All I did was the updated GUI; as always. I get bits of free code. Made lots of
freeware programs that I used to have on my Furball Cannery and
Arabica websites. And I can't code!!!! :} And they work!!!! :blushing: Thanks NET all!

Only 1 build warning.
___________________________________________________

1 warning on Build:::..

[Warning] SndBrwsMain.pas(7): W1005 Unit 'FileCtrl' is specific to a platform


Posted Image

___________________________________________________

*SndBrwsMain.pas [The code]
___________________________________________________

unit SndBrwsMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, FileCtrl, MMSystem, ShellAPI, Buttons, jpeg, ExtCtrls;

type
  TMainForm = class(TForm)
    PathEdit: TEdit;
    PathLbl: TLabel;
    DirBox: TDirectoryListBox;
    DriveBox: TDriveComboBox;
    FileList: TFileListBox;
    Label1: TLabel;
    SpeedButton1_help: TSpeedButton;
    SpeedButton2_close: TSpeedButton;
    Image1: TImage;
    Bevel1: TBevel;
    Bevel2: TBevel;
    procedure SpeedButton2_closeClick(Sender: TObject);
    procedure SpeedButton1_helpClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure PathEditChange(Sender: TObject);
    procedure DirBoxChange(Sender: TObject);
    procedure FileListClick(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure DirBoxClick(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
    procedure AppMessage(var Msg: TMsg; var Handled: boolean);
  end;

var
  MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.AppMessage(var Msg: TMsg; var Handled: boolean);
var
  Buffer: array[0..MAX_PATH] of char;
begin
  if Msg.message = WM_DROPFILES then begin
    DragQueryFile(Msg.wParam, 0, Buffer, MAX_PATH);
    PathEdit.Text := ExtractFilePath(Buffer);
    FileList.Filename := Buffer;
    FileListClick(FileList);
    DragFinish(Msg.wParam);
  end;
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(MainForm.Handle, true);
  Application.OnMessage := AppMessage;

  PathEdit.Text := 'C:\WINDOWS\MEDIA';

  if ParamStr(1) <> '' then begin
    DirBox.Directory := ExtractFilePath(ParamStr(1));
    FileList.Filename := ParamStr(1);
    FileListClick(FileList);
  end;

  PathEdit.SelStart := PathEdit.GetTextLen;
end;

procedure TMainForm.PathEditChange(Sender: TObject);
begin
  if DirectoryExists(PathEdit.Text) then begin
    DirBox.OnChange := nil;
    DirBox.Directory := PathEdit.Text;
    DirBox.OnChange := DirBoxChange;
  end;
end;

procedure TMainForm.DirBoxChange(Sender: TObject);
begin
  PathEdit.OnChange := nil;
  PathEdit.Text := DirBox.Directory;
  PathEdit.OnChange := PathEditChange;
end;                           

procedure TMainForm.FileListClick(Sender: TObject);
begin
  if FileList.ItemIndex >= 0 then
    PlaySound(PChar(FileList.Items[FileList.ItemIndex]), 0,
      SND_ASYNC OR SND_FILENAME OR SND_NODEFAULT OR SND_NOWAIT);
end;

procedure TMainForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
  // Stop currently playing sound if [ESC] is pressed
  case Key of
    #13, #32: FileListClick(FileList);
    #27: PlaySound(nil, 0, SND_PURGE);
  end;
end;

procedure TMainForm.DirBoxClick(Sender: TObject);
begin
  DirBox.Directory := DirBox.GetItemPath(DirBox.ItemIndex);
end;

 procedure TMainForm.SpeedButton1_helpClick(Sender: TObject);
begin
  MessageBeep(0);
  MessageDlg('' + #10 + '1. You can click any Wav sound to play.' + #10 + ''
  + #10 + '2. You can click a sound to play, then use the'
  + #10 + 'Keyboard = UP = and = DOWN = Arrows to move'
  + #10 + 'up and down - playing sounds.' + #10 + ''
  + #10 + '3. Use the left Folder box to click and find new'
  + #10 + 'Folders with Wav Sound Files in them.' + #10 + ''
  + #10 + '________________________________________' + #10
  + '' + #10 + 'WavEar - Freeware                              (2005)',
  mtCustom, [
mbOK], 0);
end;

procedure TMainForm.SpeedButton2_closeClick(Sender: TObject);
begin
    Close;
end;
 
end.


___________________________________________________

The program is warehoused at eazyshare.com and to download Click Here ( WavEar.rar - 251K )
___________________________________________________
___________________________________________________





Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy