PDA

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 8]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 [67] 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

vadjliss
14-02-2016, 07:47
парни как сделать что бы название программы в инсталяторе было одно, а папка куда устанавливается программа была другой

ZVSRus
14-02-2016, 14:47
парни как сделать что бы название программы в инсталяторе было одно, а папка куда устанавливается программа была другой
Я делаю так

Venelana
14-02-2016, 18:02
- Отключены кнопки Alt+F4
- Отключена кнопка "Отмена" и "Закрыть"
- Нельзя закрыть с панели задач (taskbar)

Вопрос : Как сделать этот код чтобы был он UNICODE ?
То есть перевести из ANSI в UNICODE

[Code]
const
MF_BYCOMMAND = 0;
MF_ENABLED = 0;
MF_GRAYED = 1;
MF_DISABLED = 2;
SC_CLOSE = 61536;
GCL_STYLE = -26;
CS_NOCLOSE = $200;
MF_BYPOSITION = $00000400;

type
HMENU = THandle;

function GetSystemMenu(hWnd: HWND; bRevert: BOOL): LongWord; external 'GetSystemMenu@user32.dll stdcall';
function EnableMenuItem(hMenu: THandle; uIDEnableItem: Longword; uEnable: Longword): Boolean; external 'EnableMenuItem@user32.dll stdcall';
function GetClassLong(Wnd: HWnd; Index: Integer): Longint; external 'GetClassLongA@user32.dll stdcall';
function SetClassLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetClassLongA@user32.dll stdcall';
function DeleteMenu(hMenu: HMENU; uPosition, uFlags: UINT): BOOL; external 'DeleteMenu@user32.dll stdcall';
function GetMenuItemCount(hMenu: HMENU): Integer; external 'GetMenuItemCount@user32.dll stdcall';

procedure CurPageChanged(CurPageID: Integer);
begin
EnableMenuItem(GetSystemMenu(WizardForm.Handle, false), SC_CLOSE, MF_DISABLED or MF_BYCOMMAND);
if CurPageID = wpinstalling then
WizardForm.CancelButton.Enabled := False;
if (CurPageID = wpSelectDir) or (CurPageID = wpReady) then
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
else if (CurPageID = wpFinished) then
WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish)
else
WizardForm.NextButton.Caption := SetupMessage(msgButtonNext);
end;

procedure InitializeWizard;
var
SystemMenu: HMENU;
begin
SystemMenu := GetSystemMenu(WizardForm.Handle, False);
DeleteMenu(SystemMenu, 9999, MF_BYCOMMAND);
DeleteMenu(SystemMenu, GetMenuItemCount(SystemMenu)-1, MF_BYPOSITION);
SetClassLong(WizardForm.Handle, GCL_STYLE, GetClassLong(WizardForm.Handle, GCL_STYLE) or CS_NOCLOSE);
end;

Venelana
14-02-2016, 19:36
Есть ли хоть какой способ заблокировать кнопку "Закрыть" на панели задач (taskbar) ?

kotyarko@fb
14-02-2016, 21:27
Как сделать этот код чтобы был он UNICODE ? »
function GetClassLong(Wnd: HWnd; Index: Integer): Longint; external 'GetClassLongW@user32.dll stdcall';
function SetClassLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetClassLongW@user32.dll stdcall';

Raf-9600
15-02-2016, 14:58
Есть код от El Sanchez на рекурсивный поиск всех файлов по маске. Ктонить может его переделать, чтобы найдя первый файл рекурсия тут же прекращалась и функция возвращала true?

function FindFiles(Path, Mask: string; Recurse: BOOL): TArrayOfString;
var
FindRecAll, FindRecMask: TFindRec;
begin
if not DirExists(Path) then Exit;
//
if FindFirst(AddBackslash(RemoveBackslash(Path)) + Mask, FindRecMask) then
try
repeat
if (FindRecMask.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) then
begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[GetArrayLength(Result) - 1] := AddBackslash(RemoveBackslash(Path)) + FindRecMask.Name;
end;
until not FindNext(FindRecMask);
finally
FindClose(FindRecMask);
end;
//
if Recurse then
begin
if FindFirst(AddBackslash(RemoveBackslash(Path)) + '*', FindRecAll) then
try
repeat
if (FindRecAll.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and (FindRecAll.Name <> '.') and (FindRecAll.Name <> '..') then
Result := FindFiles(AddBackslash(RemoveBackslash(Path)) + FindRecAll.Name, Mask, Recurse);
until not FindNext(FindRecAll);
finally
FindClose(FindRecAll);
end;
end;
end;

kotyarko@fb
15-02-2016, 18:51
Raf-9600, пробуйте:
Function FindFiles(Path, Mask: String): Boolean;
var
FindRecMask: TFindRec;
begin
Result := False;
if DirExists(Path) then
if FindFirst(AddBackslash(RemoveBackslash(Path)) + Mask, FindRecMask) then
try
repeat
if (FindRecMask.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) then
Result := True;
until Result;
finally
FindClose(FindRecMask);
end;
end;

vadjliss
15-02-2016, 19:35
парни вопрос как сделать дополнительный ярлык на рабочий стол

#define MainExe "{app}\Bin32\crysis.exe"
#define MainExe64 "{app}\Bin64\crysis.exe"
#define MainExeDir Copy(MainExe, 1, RPos("\", MainExe)-1)
#define MainExe64Dir Copy(MainExe64, 1, RPos("\", MainExe64)-1)


#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
AppId={{8CD106B3-D140-412D-8762-B30B13DEFF3C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion


[Icons]
Name: "{userdesktop}\{#MyAppName}"; FileName: "{#MainExe64}"; WorkingDir: "{#MainExe64Dir}"; Tasks: desktopicon; Check: IsWin64
Name: "{userdesktop}\{#MyAppName}"; FileName: "{#MainExe}"; WorkingDir: "{#MainExeDir}"; Tasks: desktopicon; Check: not IsWin64

saurn
15-02-2016, 20:32
как сделать дополнительный ярлык на рабочий стол »
Ярлык чего? Если исполняемых файлов программы, то они и так объявлены в секции Icons

Hantunyaha
16-02-2016, 13:23
Помогите пожалуйста сделать кнопку "Отмена"
Как сделать свою кнопку вместо стандартной ?

P.S
Родная кнопка у меня отключена и сделана невидимой

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FC9B3E48-8A0B-49FA-B161-675874D96F13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableWelcomePage=no
AllowCancelDuringInstall=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[Code]
procedure CurPageChanged(CurPageID: Integer);
begin
WizardForm.CancelButton.Enabled := False;
WizardForm.CancelButton.Visible := False;
end;

procedure TestButtonOnClick(Sender: TObject);
begin
MsgBox('Тест!', mbInformation, MB_OK)
end;

procedure InitializeWizard();
var
TestButton: TButton;

begin
WizardForm.OuterNotebook.Height := ScaleY(361);
WizardForm.InnerNotebook.Height := ScaleY(285);
WizardForm.Bevel.Parent := WizardForm.WelcomePage;
WizardForm.NextButton.BringToFront;
WizardForm.BackButton.BringToFront;
WizardForm.CancelButton.BringToFront;

TestButton:=TButton.Create(WizardForm);
with TestButton do
begin
Left := ScaleX(237);
Top := ScaleY(327);
Width := ScaleX(80);
Height := ScaleY(23);
Caption:='Тест';
OnClick:=@TestButtonOnClick;
Parent:=WizardForm.WelcomePage;
end;
end;

Dodakaedr
16-02-2016, 14:11
Родная кнопка у меня отключена и сделана невидимой »
Зачем? Можно ж просто её изменить
#define MyAppName "My Program"
#define MyAppVersion "1.5"

[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}

[Messages]
ExitSetupTitle=«{#MyAppName} v{#MyAppVersion}»
ExitSetupMessage=Вы действительно хотите выйти из программы установки?

Hantunyaha
16-02-2016, 14:49
Зачем? Можно ж просто её изменить »

Вот это код работает как мне нужно!
Что избавиться от этого компонента: AllowCancelDuringInstall нужно сделать свою кнопку отмена

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FC9B3E48-8A0B-49FA-B161-675874D96F13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableWelcomePage=no
AllowCancelDuringInstall=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[Code]
const
MF_BYCOMMAND = 0;
MF_ENABLED = 0;
MF_GRAYED = 1;
MF_DISABLED = 2;
SC_CLOSE = 61536;
GCL_STYLE = -26;
CS_NOCLOSE = $200;

function GetSystemMenu(hWnd: HWND; bRevert: BOOL): LongWord; external 'GetSystemMenu@user32.dll stdcall';
function EnableMenuItem(hMenu: THandle; uIDEnableItem: Longword; uEnable: Longword): Boolean; external 'EnableMenuItem@user32.dll stdcall';
function GetClassLong(Wnd: HWnd; Index: Integer): Longint; external 'GetClassLongA@user32.dll stdcall';
function SetClassLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetClassLongA@user32.dll stdcall';

procedure CurPageChanged(CurPageID: Integer);
begin
//if (CurPageID = wpInstalling) then
//begin
EnableMenuItem(GetSystemMenu(WizardForm.Handle, false), SC_CLOSE, MF_DISABLED or MF_BYCOMMAND);
SetClassLong(WizardForm.Handle, GCL_STYLE, GetClassLong(WizardForm.Handle, GCL_STYLE) or CS_NOCLOSE);
//end;
end;



Как сделать кнопку ?

saurn
16-02-2016, 22:00
Как сделать кнопку ? »
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FC9B3E48-8A0B-49FA-B161-675874D96F13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableWelcomePage=no
//AllowCancelDuringInstall=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Windows\fonts\*"; DestDir: "{app}"; Flags: ignoreversion external;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[code]
#define A = (Defined UNICODE) ? "W" : "A"


const
MF_BYCOMMAND = 0;
MF_ENABLED = 0;
MF_GRAYED = 1;
MF_DISABLED = 2;
SC_CLOSE = 61536;
GCL_STYLE = -26;
CS_NOCLOSE = $200;


function GetSystemMenu( hWnd: HWND; bRevert: BOOL ): LongWord; external 'GetSystemMenu@user32.dll stdcall';
function EnableMenuItem( hMenu: THandle; uIDEnableItem: Longword; uEnable: Longword ): Boolean; external 'EnableMenuItem@user32.dll stdcall';
function GetClassLong( Wnd: HWnd; Index: Integer ): Longint; external 'GetClassLong{#A}@user32.dll stdcall';
function SetClassLong( Wnd: HWnd; Index: Integer; NewLong: Longint ): Longint; external 'SetClassLong{#A}@user32.dll stdcall';


var
{ Declared global variables }
_tBtnCancel: TButton;


procedure _CancelClick ( const Sender: TObject );
begin
WizardForm.CancelButton.Click;
end;

procedure InitializeWizard();
begin
EnableMenuItem( GetSystemMenu( WizardForm.Handle, false ), SC_CLOSE, MF_DISABLED or MF_BYCOMMAND );
SetClassLong( WizardForm.Handle, GCL_STYLE, GetClassLong( WizardForm.Handle, GCL_STYLE ) or CS_NOCLOSE );

with WizardForm do
begin
{ Create custom button }
_tBtnCancel := TButton.Create( nil ); { Init global variable }
with _tBtnCancel do
begin
Parent := WizardForm;
SetBounds( ScaleX( WizardForm.CancelButton.Left ),
ScaleY( WizardForm.CancelButton.Top ),
ScaleX( WizardForm.CancelButton.Width ),
ScaleY( WizardForm.CancelButton.Height ) );
Caption := SetupMessage( msgButtonCancel );
BringToFront;
OnClick := @_CancelClick;
end;
end;
end;


procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpFinished: _tBtnCancel.Hide;
end;
end;


Только, в чем смысл заменять родную кнопку кастомной с идентичным событием?

Hantunyaha
17-02-2016, 12:24
Ошибка при компиляции

И часть кода перестала работать

Hantunyaha
17-02-2016, 12:24
http://s017.radikal.ru/i430/1602/fe/744371a5695e.png

TryRooM
17-02-2016, 13:15
Hantunyaha,
Используйте расширенную версию компилятора, и ошибки не будет.

Hantunyaha
17-02-2016, 13:27
Используйте расширенную версию компилятора, и ошибки не будет »
Использую только официальные версии!

kotyarko@fb
17-02-2016, 13:40
Hantunyaha, используйте:
WizardForm.CancelButton.OnClick(nil);

Nordek
17-02-2016, 14:10
Ошибка при компиляции »Проверил:
В стандартной версии не работает.
В расширенной версии работает.

Используйте расширенную версию.

Использую только официальные версии! »Если вы настроены на расширенную версию категорично - придётся ограничиться малым. Поскольку в одной ситуации решение будет найдено, в другой уже будет проблематично.

Reyesahydo
17-02-2016, 17:48
Как записать ключ в реестр ?
Нужно записать этот ключ: AAAAA-AAAAA-AAAAA-AAAAA




© OSzone.net 2001-2012