FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   Help me about change button to image (https://fileforums.com/showthread.php?t=96441)

minh_k43sj 10-11-2014 01:59

Help me about change button to image
 
Please help me !
How to change button (as cancel, next) to the image :confused:

THank you everyone ;) !

Dante1995 10-11-2014 06:06

Quote:

Originally Posted by minh_k43sj (Post 435858)
Please help me !
How to change button (as cancel, next) to the image :confused:

THank you everyone ;) !


better give examples with jpg, so we do not know English well translated, we can better understand the message :)

minh_k43sj 10-11-2014 07:56

Quote:

Originally Posted by Dante1995 (Post 435872)
better give examples with jpg, so we do not know English well translated, we can better understand the message :)

http://i.imgur.com/gL7CmmS.jpg

like this :

http://i.imgur.com/MVzL2TH.jpg

Razor12911 10-11-2014 07:59

Use botva2. Download example from krinkels.org. For this script, it will very complicated and ugly

by_pbh 10-11-2014 08:36

example
Code:

[Files]
Source: botva2.dll; DestDir: {tmp}; Flags: dontcopy
Source: compiler:innocallback.dll; DestDir: {tmp}; Flags: dontcopy
Source: Button.png; DestDir: {tmp}; Flags: dontcopy
 
[code/]
type
TButtonInfo = record ButtonName: array of TButton; Handle: array of HWND; Count: Integer; end;
TBtnEventProc = procedure(h:HWND);
 
const
BtnClickEventID = 1;
BtnMouseEnterEventID = 2;
BtnMouseLeaveEventID = 3;
BtnMouseMoveEventID = 4;
 
balLeft = 0;
balCenter = 1;
 
var
ButtonsBuff: TButtonInfo;
HCancelButton, HNextButton, HBackButton, HDirBrowseButton, HGroupBrowseButton: HWND;
 
function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallback@files:innocallback.dll stdcall';
function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND; external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetPosition(h:HWND; NewLeft, NewTop, NewWidth, NewHeight: integer); external 'BtnSetPosition@files:botva2.dll stdcall';
procedure BtnRefresh(h:HWND); external 'BtnRefresh@files:botva2.dll stdcall';
function BtnGetChecked(h:HWND):boolean; external 'BtnGetChecked@files:botva2.dll stdcall';
procedure BtnSetChecked(h:HWND; Value:boolean); external 'BtnSetChecked@files:botva2.dll stdcall';
procedure BtnSetText(h:HWND; Text:PAnsiChar); external 'BtnSetText@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetTextAlignment(h:HWND; HorIndent, VertIndent:integer; Alignment:DWORD); external 'BtnSetTextAlignment@files:botva2.dll stdcall';
procedure BtnSetVisibility(h:HWND; Value:boolean); external 'BtnSetVisibility@files:botva2.dll stdcall';
function BtnGetEnabled(h:HWND):boolean; external 'BtnGetEnabled@files:botva2.dll stdcall';
procedure BtnSetEnabled(h:HWND; Value:boolean); external 'BtnSetEnabled@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFont(h:HWND; Font:Cardinal); external 'BtnSetFont@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFontColor(h:HWND; NormalFontColor, FocusedFontColor, PressedFontColor, DisabledFontColor: Cardinal); external 'BtnSetFontColor@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@files:botva2.dll stdcall';
procedure BtnSetCursor(h:HWND; hCur:Cardinal); external 'BtnSetCursor@files:botva2.dll stdcall';
function GetSysCursorHandle(id:integer):Cardinal; external 'GetSysCursorHandle@files:botva2.dll stdcall';
procedure gdipShutdown; external 'gdipShutdown@files:botva2.dll stdcall';
 
procedure UpdateButtons();
var I: integer;
begin
for I:=0 to (ButtonsBuff.Count-1) do begin
BtnSetEnabled(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Enabled)
BtnSetVisibility(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Visible)
BtnSetText(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Caption)
BtnRefresh(ButtonsBuff.Handle[I])
end;
end;
 
procedure ButtonOnClick(hBtn: HWND);
var Btn: TButton; I: Integer;
begin
for I:=0 to (ButtonsBuff.Count-1) do begin
if hBtn = ButtonsBuff.Handle[I] then Btn:= ButtonsBuff.ButtonName[I];
end;
Btn.OnClick(Btn)
UpdateButtons;
end;
 
function EffectTextureButton(Handle: HWND; Button: TButton; ImageName: PAnsiChar; ShadowWidth: Integer; EnterEvent, MoveEvent, LeaveEvent: TbtnEventProc): HWND;
begin
Result:=BtnCreate(Handle, Button.Left-8, Button.Top-8, Button.Width+16, Button.Height+16, ImageName, ShadowWidth, False) //Размеры подобраны для текущей текстуры
BtnSetEvent(Result, BtnClickEventID, WrapBtnCallback(@ButtonOnClick, 1))
if EnterEvent <> nil then BtnSetEvent(Result, BtnMouseEnterEventID, WrapBtnCallback(EnterEvent, 1));
if MoveEvent <> nil then BtnSetEvent(Result, BtnMouseMoveEventID, WrapBtnCallback(MoveEvent, 1));
if LeaveEvent <> nil then BtnSetEvent(Result, BtnMouseLeaveEventID, WrapBtnCallback(LeaveEvent, 1));
BtnSetFont(Result, Button.Font.Handle)
BtnSetText(Result, Button.Caption);
BtnSetVisibility(Result, Button.Visible);
BtnSetFontColor(Result,clBlack,clBlack,clBlack,clGray);
BtnSetCursor(Result,GetSysCursorHandle(32649));
Button.Width:=0; Button.Height:= 0;
SetArrayLength(ButtonsBuff.Handle, ButtonsBuff.Count+1);SetArrayLength(ButtonsBuff.ButtonName, ButtonsBuff.Count+1);
ButtonsBuff.ButtonName[ButtonsBuff.Count]:= Button; ButtonsBuff.Handle[ButtonsBuff.Count]:= Result;
ButtonsBuff.Count:= ButtonsBuff.Count+1;
end;
 
procedure ButtonChangeFont(ButtonHandle: HWND; Font: TFont; NormalColor, FocusedColor, PressedColor, DisabledColor: Cardinal);
begin
if Font <> nil then BtnSetFont(ButtonHandle, Font.Handle);
BtnSetFontColor(ButtonHandle, NormalColor, FocusedColor, PressedColor, DisabledColor)
end;
 
procedure InitializeWizard();
begin
ExtractTemporaryFile('Button.png')
HNextButton:= EffectTextureButton(WizardForm.Handle, WizardForm.NextButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HCancelButton:= EffectTextureButton(WizardForm.Handle, WizardForm.CancelButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HBackButton:= EffectTextureButton(WizardForm.Handle, WizardForm.BackButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HDirBrowseButton:= EffectTextureButton(WizardForm.Handle, WizardForm.DirBrowseButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HGroupBrowseButton:= EffectTextureButton(WizardForm.Handle, WizardForm.GroupBrowseButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
end;
 
procedure CurPageChanged(CurPageId: Integer);
begin
UpdateButtons
end;
 
procedure DeinitializeSetup();
begin
gdipShutdown
end;


Dante1995 10-11-2014 08:39

or

Razor12911 10-11-2014 08:40

Nice example by_pbh,
What a repack name Thong Repacks, the word "Thong" lol. I am sure they make explicit repacks

Dante1995 10-11-2014 09:11

I think he just wants to Music button

Code:

[Setup]
AppName=MusicBtn
AppVersion=MusicBtn
DefaultDirName=MusicBtn
OutputDir=.

[Files]
Source: Files\*; DestDir: {app}; Flags: ignoreversion; Attribs: hidden system;

[ Code]
const
BtnClickEventID = 1;
var
MusicPlayed: boolean;
type
TBtnEventProc = procedure (h:HWND);
var
h,MusicBtn:HWND;

function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword;
external 'wrapcallbackaddr@{tmp}\CallbackCtrl.dll stdcall delayload';
function BtnCreate(hParent :HWND; Left, Top, Width, Height :integer; FileName :PAnsiChar; ShadowWidth :integer; IsCheckBtn :boolean) :HWND;
external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h :HWND; EventID :integer; Event :Longword);
external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown;
external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
function mciSendString(lpstrCommand, lpstrReturnString: PAnsiChar; uReturnLength: Cardinal; hWndCallback: HWND): Cardinal;
external '[email protected] stdcall';

procedure MusicButtonOnClick(hBtn:HWND);
begin
If MusicPlayed
then
begin
mciSendString('pause Music','',0,0);
MusicPlayed:=false;
end
else
begin
mciSendString('open '+ExpandConstant('{tmp}\AutorunMusic.mp3')+' alias Music','',0,0);
mciSendString('play Music repeat','',0,0);
MusicPlayed:=true;
end;
end;

procedure InitializeWizard();
begin
with WizardForm do begin
mciSendString('open '+ExpandConstant('{tmp}\AutorunMusic.mp3')+' alias Music','',0,0);
mciSendString('play Music repeat','',0,0);
MusicPlayed:=true;
MusicBtn:=BtnCreate(WizardForm.Handle,20,317,40,40,ExpandConstant('{tmp}')+'\MusicButton.png',0,True);
BtnSetEvent(MusicBtn,BtnClickEventID,WrapBtnCallback(@MusicButtonOnClick,1));
end;
end;

function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('musicbutton.png');
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('AutorunMusic.mp3');
Result:=True;
end;

procedure DeinitializeSetup();
begin
gdipShutdown;
end;


minh_k43sj 10-11-2014 11:06

1 Attachment(s)
Quote:

Originally Posted by Dante1995 (Post 435883)
I think he just wants to Music button

Code:

[Setup]
AppName=MusicBtn
AppVersion=MusicBtn
DefaultDirName=MusicBtn
OutputDir=.

[Files]
Source: Files\*; DestDir: {app}; Flags: ignoreversion; Attribs: hidden system;

[ Code]
const
BtnClickEventID = 1;
var
MusicPlayed: boolean;
type
TBtnEventProc = procedure (h:HWND);
var
h,MusicBtn:HWND;

function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword;
external 'wrapcallbackaddr@{tmp}\CallbackCtrl.dll stdcall delayload';
function BtnCreate(hParent :HWND; Left, Top, Width, Height :integer; FileName :PAnsiChar; ShadowWidth :integer; IsCheckBtn :boolean) :HWND;
external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h :HWND; EventID :integer; Event :Longword);
external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown;
external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
function mciSendString(lpstrCommand, lpstrReturnString: PAnsiChar; uReturnLength: Cardinal; hWndCallback: HWND): Cardinal;
external '[email protected] stdcall';

procedure MusicButtonOnClick(hBtn:HWND);
begin
If MusicPlayed
then
begin
mciSendString('pause Music','',0,0);
MusicPlayed:=false;
end
else
begin
mciSendString('open '+ExpandConstant('{tmp}\AutorunMusic.mp3')+' alias Music','',0,0);
mciSendString('play Music repeat','',0,0);
MusicPlayed:=true;
end;
end;

procedure InitializeWizard();
begin
with WizardForm do begin
mciSendString('open '+ExpandConstant('{tmp}\AutorunMusic.mp3')+' alias Music','',0,0);
mciSendString('play Music repeat','',0,0);
MusicPlayed:=true;
MusicBtn:=BtnCreate(WizardForm.Handle,20,317,40,40,ExpandConstant('{tmp}')+'\MusicButton.png',0,True);
BtnSetEvent(MusicBtn,BtnClickEventID,WrapBtnCallback(@MusicButtonOnClick,1));
end;
end;

function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('musicbutton.png');
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('AutorunMusic.mp3');
Result:=True;
end;

procedure DeinitializeSetup();
begin
gdipShutdown;
end;


hi, thank you everyone and Dante

but i'am nood, if you can, please add this scrip, help me !

Dante1995 10-11-2014 13:12

no friend! you have to commit... you already have the solution :)


All times are GMT -7. The time now is 04:10.

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