Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 28-08-2014, 17:00
gatosky1620's Avatar
gatosky1620 gatosky1620 is offline
Registered User
 
Join Date: Oct 2011
Location: Perú
Posts: 287
Thanks: 13
Thanked 966 Times in 131 Posts
gatosky1620 is on a distinguished road
I want add a ButtonOnMouse Sound

How add a .wav file with the mouse on the button(OnMouseEnter). because always i have the proble unknow indentifier

[CODE]
Code:
var HForm: TSetupForm;
    AbgImage : TBitmapImage;
    #ifdef AutorunStandardButtons
    Button1,Button2,Button3: TNewButton;
    #endif
    #ifdef AutorunLabelButtons
    ButtonLabel1,ButtonLabel2,ButtonLabel3,ButtonLabel4,LabelMouse : TLabel;
    ButtonsLabelShadow: array [1..4] of TLabel;
    #endif
    #ifdef AMusicLoop
    MLabel : TLabel;
    MPanel: Tpanel;
    MBitmap : TBitmapImage;
    #endif
    MCIstr: PChar;
    Install: Boolean;
    mute: byte;

const
    AWidth= 704;
    AHeight= 372;
    SND_OPT= $1;
    OnMouseOutALabelButtonsFontSize= 17;
    OnMouseOverALabelButtonsFontSize= 20;
    AFontName= 'Impact';
    LabelButtonsTop= 325;
    LabelButtonsLeft= 85; 


#ifdef AutorunLabelButtons
procedure ButtonLabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
TLabel(sender).Font.Size:=OnMouseOverALabelButtonsFontSize;  
TLabel(sender).Font.Color:=ClRed;
ButtonsLabelShadow[TLabel(Sender).Tag].Font.Size:= OnMouseOverALabelButtonsFontSize;
end;

procedure LabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
ButtonLabel1.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[1].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel1.Font.Color:= ClWhite;
ButtonLabel2.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[2].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel2.Font.Color:= ClWhite;
ButtonLabel3.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[3].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel3.Font.Color:= ClWhite;
ButtonLabel4.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonLabel4.Font.Color:= ClWhite;
ButtonsLabelShadow[4].Font.Size:= OnMouseOutALabelButtonsFontSize;
end;

procedure BrowseLabelOnClick(Sender: TObject);
var
  ErrorCode: Integer;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
ShellExec('', ExpandConstant('{src}'),
     '', '', SW_SHOW, ewNoWait, ErrorCode); 
end;


procedure PILabelOnClick(Sender: TObject);
Var ResultCode: integer;
    appath: string;

begin
 PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
 if TLabel(sender).caption=ExpandConstant('{cm:AInstall}') then begin
 HForm.Close
 Install:=True;
 end else begin
 RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
     'InstallFolder', appath)
 if not Exec(appath+'\Launcher.exe', '', '', SW_SHOW,
     ewNoWait, ResultCode) then MsgBox(SysErrorMessage(ResultCode)+': Launcher.exe', mbCriticalError, MB_OK)
     else begin
 HForm.Close;
 Install:=False;
 end;
 end;
end;

procedure UnInstLabelOnClick(Sender: TObject);
Var ResultCode: integer;
    appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
     'InstallFolder', appath)
     Exec((appath +'\unins000.exe'), '', '', SW_SHOW,
      ewNoWait, ResultCode)
HForm.Close
Install:=False;
end;

procedure ExitLabelOnClick(Sender: TObject);

begin
 PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
 HForm.Close
 Install:=False;
end;
#endif

#ifdef AutorunStandardButtons
procedure PIButtonOnClick(Sender: TObject);
Var ResultCode: integer;
    appath: string;

begin
 PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
 if TNewButton(sender).caption=ExpandConstant('{cm:AInstall}') then begin
 HForm.Close
 Install:=True;
 end else begin
 RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
     'InstallPath', appath)
 if not Exec(appath+'\Launcher.exe', '', '', SW_SHOW,
     ewNoWait, ResultCode) then MsgBox(SysErrorMessage(ResultCode)+': Launcher.exe', mbCriticalError, MB_OK)
     else begin
 HForm.Close;
 Install:=False;
 end;
 end;
end;

procedure ExitButtonOnClick(Sender: TObject);

begin
 PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
 HForm.Close
 Install:=False;
end;

procedure UnInstButtonOnClick(Sender: TObject);
Var ResultCode: integer;
    appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
     'InstallFolder', appath)
     Exec((appath +'\unins000.exe'), '', '', SW_SHOW,
      ewNoWait, ResultCode)
HForm.Close
Install:=False;
end;
#endif

#ifdef AMusicLoop
procedure MLabelOnClick(Sender: TObject);

begin
      PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
Case mute of
      0: begin
      mciSendString('PAUSE AMusicLoop', MCIstr, 255, 0);
      MBitmap.Left:=ScaleX(-23);
      mute:=1;
      end;
      1: begin
      mciSendString('PLAY AMusicLoop REPEAT', MCIstr, 255, 0);
      MBitmap.Left:=0;
      mute:=0;
      end;
end;
end;
#endif

function LaunchAutorun: Boolean;

begin
#ifdef AMusicLoop
ExtractTemporaryFile('{#Autorunmp3filename}');
ExtractTemporaryFile('mute_on_off.bmp');
#endif
ExtractTemporaryFile('{#ClickSoundfilename}');
ExtractTemporaryFile('AutorunBGI.BMP');
HForm:=CreateCustomForm;

With HForm Do
Begin
ClientWidth:=AWidth;
ClientHeight:=AHeight;
Position := poScreenCenter;
BorderIcons := [biSystemMenu];
Caption:=ExpandConstant('{cm:AppName} - Autorun');
end;

AbgImage:=TBitmapImage.Create(HForm);
With AbgImage Do
Begin
Parent:=HForm;
Align:=alClient;
Stretch:=True;
end;
AbgImage.bitmap.LoadFromFile(ExpandConstant('{tmp}\AutorunBGI.BMP'));

#ifdef AutorunLabelButtons
LabelMouse:=TLabel.Create(HForm);
With LabelMouse Do
Begin
Parent:=HForm;
Transparent:=True;
Width:=HForm.Width;
Height:=HForm.Height;
Caption:='';
OnMouseMove := @LabelMouseMove;
end;
#endif

#ifdef AutorunStandardButtons
Button1:=TNewButton.Create(HForm);
With Button1 Do
Begin
Parent:=HForm;
Left:= 150;
Top:=279;
Cursor:=crHand;
OnClick := @PIButtonOnClick;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;

Button2:=TNewButton.Create(HForm);
With Button2 Do
Begin
Parent:=HForm;
Caption:=ExpandConstant('{cm:AUnistall}');
Left:=249;
Top:=Button1.Top;
Cursor:=crHand;
OnClick := @UnInstButtonOnClick;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Enabled:=True else Enabled:=False;
end;

Button3:=TNewButton.Create(HForm);
With Button3 Do
Begin
Parent:=HForm;
Caption:=ExpandConstant('{cm:Aexit}');
Left:=348;
Top:=Button1.Top;
Cursor:=crHand;
OnClick := @ExitButtonOnClick;
end;
#endif

#ifdef AMusicLoop
MPanel := TPanel.Create(HForm);
with MPanel do
begin
Left := 672;
Top := 9;
Width := 23;
Height := 23;
Caption := '';
Parent := HForm;
end;

MBitmap := TBitmapImage.Create(HForm);
with MBitmap do
begin
  	
Parent := MPanel;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(46);
Height := ScaleY(23);
MBitmap.bitmap.loadfromfile(ExpandConstant('{tmp}\mute_on_off.bmp'))
end;

MLabel:=TLabel.Create(HForm);
With MLabel Do
Begin
Parent:=MPanel;
Transparent:=True;
Left:=0;
Top:=0;
Font.Color:=ClWhite;
Width:=23;
Height:=23;
Autosize:=False;
Caption:='';
Font.Name:='Arial';
Font.Style:=[fsBold];
Font.Size:= 7;
Cursor:=crHand;
OnClick := @MLabelOnClick;
end;
mute:=0;
#endif

#ifdef AutorunLabelButtons
ButtonsLabelShadow[1]:=TLabel.Create(HForm);
With ButtonsLabelShadow[1] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleX(1);
Top:=LabelButtonsTop+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:='';
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;

ButtonLabel1:=TLabel.Create(HForm);
With ButtonLabel1 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft;
Top:=LabelButtonsTop;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:='';
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=1;
OnClick := @PILabelOnClick;
OnMouseMove := @ButtonLabelMouseMove;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;

ButtonsLabelShadow[2]:=TLabel.Create(HForm);
With ButtonsLabelShadow[2] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(102);
Top:=ButtonLabel1.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:AUnistall}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;

ButtonLabel2:=TLabel.Create(HForm);
With ButtonLabel2 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(101);
Top:=ButtonLabel1.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:AUnistall}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=2;
OnClick := @UnInstLabelOnClick;
OnMouseMove := @ButtonLabelMouseMove;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Enabled:=True else Enabled:=False;
end;

ButtonsLabelShadow[3]:=TLabel.Create(HForm);
With ButtonsLabelShadow[3] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(282);
Top:=ButtonLabel2.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:ABrowse}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;

ButtonLabel3:=TLabel.Create(HForm);
With ButtonLabel3 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(281);
Top:=ButtonLabel2.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:ABrowse}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=3;
OnClick := @BrowseLabelOnClick;;
OnMouseMove := @ButtonLabelMouseMove;
end;

ButtonsLabelShadow[4]:=TLabel.Create(HForm);
With ButtonsLabelShadow[4] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(500);
Top:=ButtonLabel3.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:Aexit}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;

ButtonLabel4:=TLabel.Create(HForm);
With ButtonLabel4 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(499);
Top:=ButtonLabel3.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:Aexit}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=4;
OnClick := @ExitLabelOnClick;
OnMouseMove := @ButtonLabelMouseMove;
end;
#endif

#ifdef AMusicLoop
mciSendString('OPEN ' + ExpandConstant('{tmp}') + '\{#Autorunmp3filename} TYPE MPEGVIDEO ALIAS AMusicLoop', MCIstr, 255, 0);
mciSendString('PLAY AMusicLoop REPEAT', MCIstr, 255, 0);
#endif
HForm.ShowModal;
#ifdef AMusicLoop
mciSendString('STOP AMusicLoop', MCIstr, 255, 0);
#endif
HForm.Free;
Result:=Install;
end;
Reply With Quote
The Following User Says Thank You to gatosky1620 For This Useful Post:
y_thelastknight (29-08-2014)
Sponsored Links
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange sound problem Space Cowboy1 PC Games 11 09-06-2006 04:15
Sound Blaster Audigy 2 & 4 Series 2005 Update v5.12.8.1164 Jedimaster Player Hardware 2 31-03-2006 04:03
Sound ISSUES with 007:Nightfire Stiffler PC Games 0 08-12-2002 16:53
sound for BF942 lucky luke15 PC Games 1 04-10-2002 12:49
We need a SCREAMING HEAD icon! Sould Calibur Sound FIX?!?!? kevinflynn DC Games 1 27-03-2001 13:40



All times are GMT -7. The time now is 11:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com