Jump to content
Korean Random
EvilAlex

Создание инсталляторов для модпаков на базе Inno Setup

Recommended Posts

Юникодовская расширенная

Так тебе по идеи вообще перекодировка не нужна..

xml на сервере перевести в utf8 и XMLStringReadValue из XML.iss заменить на эту:

Function XMLStringReadValue(sFileText: String; sTagName: string; var sData: string): Boolean;
var
  i: Integer; Tags: array of TTagPoint;
begin
  Result:= False
  if sFileText <> '' then begin
    Tags:= ExpandTags(sFileText, sTagName);
    If GetExists(Tags) then begin
      i:= GetArrayLength(Tags)-1;
      if Tags[i].IsSingle then Exit;
      sData:= Copy(sFileText, Tags[i].BeginPosII+1, Tags[i].EndPosI-Tags[i].BeginPosII-1);
      Result:= True;
    end;
  end;
  SetArrayLength(Tags, 0);
end;

Или я что-то путаю..

Edited by Kotyarko_O

Share this post


Link to post

Short link
Share on other sites
xml на сервере перевести в utf8 и XMLStringReadValue из XML.iss заменить на эту:

Неа, результат тот же.

А кодировка файла из которого компилируется программа не влияет?

он у меня в кодировке Windows-1251

 

Видимо влияет, но его перекодировка пользы не приносит

post-8756-0-20489500-1432459418_thumb.jpg

Edited by -zav-

Share this post


Link to post

Short link
Share on other sites

 

 

А кодировка файла из которого компилируется программа не влияет?
Нет.

Даже и не знаю, что делать..

Share this post


Link to post

Short link
Share on other sites

Если найду время, то подыму на сервере файл и попробую покрутить.

Share this post


Link to post

Short link
Share on other sites

Почему не работает Слеш?

Задержка для картинки есть, а картинки нету.

[Files]
Source: Splash\splash.png; Flags: dontcopy
Source: Splash\isgsg.dll; Flags: dontcopy

[Code]
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
procedure Splash();
begin
    ExtractTemporaryFile('Splash.png');
    ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\Splash.png',1000,3000,1000,0,255,False,$FFFFFF,10);
end;

procedure InitializeWizard();
begin
    Splash();
end;

Share this post


Link to post

Short link
Share on other sites

 

Если расширенная Unicode, то:

p2:AnsiString

Спс заработало :ic:

При выборе  чекбокса с озвучкой, чекбокс без озвучки начинает звучать его мелодии, как это исправить?

[Setup]
AppName=SoundResourceDemo
AppVerName=1.0
DefaultDirName={pf}\SoundResourceDemo
OutputDir=.
RawDataResource=SndA:bugreporter_succeeded.wav |SndB:WindowsLogoffSound.wav |SndE:Sound1.wav
[Components]
Name: "main"; Description: "Main Files";
Name: "main\a"; Description: "A Files";
Name: "main\b"; Description: "B Files";
Name: "main\c"; Description: "C Files";
Name: "main\d"; Description: "D Files";
Name: "main\e"; Description: "E Files";
[Code]
#define A = (Defined UNICODE) ? "W" : "A"
type
    HINST = THandle;
    HMODULE = HINST;
    Pointer = Longint;
    HRSRC = THandle;
    HGLOBAL = THandle;
const
    SND_ASYNC           = $0001;
    SND_NODEFAULT       = $0002;
    SND_MEMORY          = $0004;
    RT_RCDATA           = 10;

function sndPlaySound(lpszSoundName: Pointer; uFlags: UINT): BOOL; external 'sndPlaySound{#A}@Winmm.dll stdcall';
function LoadResource(hModule: HINST; hResInfo: HRSRC): HGLOBAL; external '[email protected] stdcall';
function FindResource(hModule: HMODULE; lpName: String; lpType: Longint): HRSRC; external 'FindResource{#A}@kernel32.dll stdcall';
function LockResource(hResData: HGLOBAL): Pointer; external '[email protected] stdcall';
var
pSoundMemory_A, pSoundMemory_B, pSoundMemory_E: Pointer;
   
function GetResourceSoundAddr(const ResourceName: String): Pointer;
var
    hResourceSound: HRSRC;
begin
    hResourceSound := FindResource(HInstance, ResourceName, RT_RCDATA);
    Result := LockResource(LoadResource(HInstance, hResourceSound));
end;
procedure ComponentsOnClickCheck(Sender: TObject);
begin
    if IsComponentSelected('main\a') then
    begin
    sndPlaySound(pSoundMemory_B, SND_MEMORY or SND_NODEFAULT or SND_ASYNC);
    end;
    if IsComponentSelected('main\b') then
    begin
    sndPlaySound(pSoundMemory_A, SND_MEMORY or SND_NODEFAULT or SND_ASYNC);
    end;
    if IsComponentSelected('main\e') then
    begin
    sndPlaySound(pSoundMemory_E, SND_MEMORY or SND_NODEFAULT or SND_ASYNC);
    end;
end;
procedure InitializeWizard();
begin
    pSoundMemory_A := GetResourceSoundAddr('_IS_SNDA');
    pSoundMemory_B := GetResourceSoundAddr('_IS_SNDB');
    pSoundMemory_E := GetResourceSoundAddr('_IS_SNDB');
   
    WizardForm.ComponentsList.OnClickCheck := @ComponentsOnClickCheck;
end;

Share this post


Link to post

Short link
Share on other sites

 

Если расширенная Unicode, то:

p2:AnsiString

блин спасибо. у меня со сплешем тоже трабла была.

Share this post


Link to post

Short link
Share on other sites

Через него проще всего сделать такие вещи. По такому же принципу можно сделать отправку запроса на сервер (читай количество установок). Но там нужно ещё что бы сервер лог вёл запросов на него и обработать всё это дело правильно.

Мечтаю сделать в своем сетапе данную фичу. Случаем примеров нету? А то погуглил, ничего не нашел. За ранее спасибо.

Share this post


Link to post

Short link
Share on other sites

ну так например

 

procedure RedesignWizardForm;
begin
with WizardForm do
begin
Caption := '{#MyAppName}' + ' v.' +'{#MyAppVersion}';
AutoScroll := False;
Position := poScreenCenter;
ClientHeight := ScaleY(525);
ClientWidth := ScaleX(734);
end;

А еще придется править все размеры и координаты элементов.

 

PS

И раз вы уже тут исправьте у себе в инсталляторе код клиента танков, на код клиента кораблей, а то снесете людям path.xml в танках и они не очень будут этому рады :gg:

в том то и прикол что у меня нет строк которые вы привели в пример. Они появляются при попытке манипуляций в редакторе  форм но потом пр  компиляции появляется такая ошибка 

post-21236-0-19315600-1432586617_thumb.jpg

Share this post


Link to post

Short link
Share on other sites

@licimer, по аналогии с этим.

про аналогию я в курсе. я не могу допетрить как мне размер этот выловить. где.

Edited by licimer

Share this post


Link to post

Short link
Share on other sites

 

 

в общем вот из скрипта одного товарища который тут выкладывал. подскажите где тут размер окна установщика выловить?
var
HeightOffset, WidthOffset: Integer;
begin
HeightOffset:=170;
WidthOffset:=200;

WizardForm.Height:=WizardForm.Height + HeightOffset;
WizardForm.Width:=WizardForm.Width + WidthOffset;
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites
var
HeightOffset, WidthOffset: Integer;
begin
HeightOffset:=170;
WidthOffset:=200;

WizardForm.Height:=WizardForm.Height + HeightOffset;
WizardForm.Width:=WizardForm.Width + WidthOffset;

Спасибо тебе огромное! Сам бы в жизни не допер. Теперь 2-4 часа буду с размерами и картинками возится. но это приятная возня.  Придется отложить ведьмака 3 на потом.

@licimer, по аналогии с этим.

Слушай а может подскажешь как в тот код что я тебе скинул скин впихнуть. а то я как ни пробовал не хочет работать.

Share this post


Link to post

Short link
Share on other sites

 

Hey Dark_Knight_MiX......

 

Thank you for this link, the "trim" version worked for me, but not the main version.

I had just asked for help with getting this kind of code so I can have sound previews, so thank you.

 

But, I have a question.

 

This part of the code:

procedure InitializeWizard();
begin
  WizardForm.TypesCombo.Visible:=False;
  WizardForm.ComponentsList.Height := ScaleY(181) - WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Top := WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Width := ScaleX(417);
  sndCompOldProc:= WizardForm.ComponentsList.OnClick;
  WizardForm.ComponentsList.OnClick:= @PlaySound;

  ExtractTemporaryFile('piano2.wav');
  ExtractTemporaryFile('organfinale.wav');
  AddItemSound(15, '{tmp}\piano2.wav');
  AddItemSound(16, '{tmp}\organfinale.wav');
end;

Instead of having 15 & 16 to connect to the components menu item, how can the code be changed to recognize the "Components" "Description" Name?

For example the Description name that's here:

 

[Components]

Name: Tank_Icons\Advanced_Icons; Description: Advanced Contour Icons; Flags: exclusive disablenouninstallwarning

 

As an example the "pic" part of my code uses the Description name to connect the pic with the menu item, which is what I'm talking about.

 

'Advanced Contour Icons': UndefPic := 'adv_icon.bmp';

 

If anyone can help with this thank you....

 

-----

 

One other thing......

 

How could the code be changed so the sound plays on "Mouse Over" rather than "clicking" the menu item?

 

Thanks

 

------

 

Here's the full CompSound(trim).iss code.....

[Setup]
AppName=My Program
AppVerName=My Program 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
ComponentsListTVStyle=true

[Files]
Source: sounds\*; flags: dontcopy;

[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl

[Components]
Name: dummy1; Description: dummy1; Flags: collapsed
Name: dummy1\dummy2; Description: dummy2;
Name: dummy1\dummy3; Description: dummy3;
Name: dummy1\dummy4; Description: dummy4;
Name: dummy1\dummy5; Description: dummy5;
Name: dummy1\dummy5\dummy1; Description: dummy6;
Name: dummy1\dummy5\dummy2; Description: dummy7;
Name: dummy1\dummy6; Description: dummy8;
Name: dummy2; Description: dummy9;
Name: dummy2\dummy2; Description: dummy10;
Name: dummy2\dummy3; Description: dummy11;
Name: dummy2\dummy4; Description: dummy12;
Name: dummy2\dummy5; Description: dummy13;
Name: sound; Description: Çâóê âûñòðåëà; Types: full;
Name: sound\snd1; Description: "Òèõèé"; Flags: exclusive;
Name: sound\snd2; Description: "Ãðîìêèé"; Flags: exclusive;

[Code]
const
  LB_ITEMFROMPOINT  = $01A9;
#ifdef UNICODE
  #define A "W"
  #define Phrase "#$266B#$266B"
#else
  #define A "A"
  #define Phrase "'(ïðèìåð)'";
#endif

type
  TComponentSound = record
    SoundName: String;
    Index: Integer;
  end;

var
  iSound: array of TComponentSound;
  sndCompOldProc: TNotifyEvent;

function GetCursorPos(var lpPoint: TPoint): BOOL; external '[email protected] stdcall';
function MapWindowPoints(hWndFrom, hWndTo: HWND; var lpPoints: TPoint; cPoints: UINT): Integer; external '[email protected] stdcall';
function sndPlaySound(lpszSoundName: String; fuSound: UINT): BOOL; external 'sndPlaySound{#A}@winmm.dll stdcall';

procedure PlaySound(Sender: TObject);
var
  x, o, n, i, f, diff, lParam, ids, w1, w2, x1, x2: Integer;
  p: TPoint;
  sp, s: String;
  fnt: TFont;
  box: TNewCheckListBox;
begin
  box:= TNewCheckListBox(Sender);

  GetCursorPos(p);
  MapWindowPoints(0, box.Handle, p, 1);

  lParam:= p.x or (p.y shl 16);
  i:= SendMessage(WizardForm.ComponentsList.Handle, LB_ITEMFROMPOINT, 0, lParam);
  if ((i shr 16) = 1) or ((i and $FFFF) < 0) then Exit;
  i:= i and $FFFF;
  
  if (i < 0) or (i >= box.ItemCount) then Exit;
  
  diff:= 0;
  f:= 0;
  while (f < i) do begin
    n:= f + diff;
    if (n >= box.ItemCount) then Break;

    if (not box.ItemExpanded[n]) then begin
      while ((f + diff + 1 < box.ItemCount)) and (box.ItemLevel[f + diff + 1] > box.ItemLevel[n]) do
        diff:= diff + 1;
    end;
    
    f:= f + 1;
  end;
  ids:= i + diff;

  f:= -1;
  for i:= 0 to GetArrayLength(iSound)-1 do begin
    if (ids = iSound[i].Index) then begin
      f:= i;
      Break;
    end;
  end;

  if (f < 0) then Exit;

  s:= box.ItemCaption[ids];
  if (Pos({#Phrase}, s) <= 0) then Exit;

  if FileExists(iSound[f].SoundName) then
    sndPlaySound(iSound[f].SoundName, 1);
  
  if (sndCompOldProc <> nil) then
    sndCompOldProc(Sender);
end;

procedure AddItemSound(AIndex: Integer; AFilename: String);
var
  i: Integer;
begin
  i:= GetArrayLength(iSound);
  SetArrayLength(iSound, i+1);
  iSound[i].Index:= AIndex-1;
  iSound[i].SoundName:= ExpandConstant(AFilename);
  WizardForm.ComponentsList.ItemCaption[AIndex-1]:= WizardForm.ComponentsList.ItemCaption[AIndex-1] + ' '+{#Phrase};
end;

procedure InitializeWizard();
begin
  WizardForm.TypesCombo.Visible:=False;
  WizardForm.ComponentsList.Height := ScaleY(181) - WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Top := WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Width := ScaleX(417);
  sndCompOldProc:= WizardForm.ComponentsList.OnClick;
  WizardForm.ComponentsList.OnClick:= @PlaySound;

  ExtractTemporaryFile('piano2.wav');
  ExtractTemporaryFile('organfinale.wav');
  AddItemSound(15, '{tmp}\piano2.wav');
  AddItemSound(16, '{tmp}\organfinale.wav');
end;
Edited by leeuniverse

Share this post


Link to post

Short link
Share on other sites

Hello, another question....

 

Is there a way to "rename" a file when it's being copied from source to it's install location?

 

For example....

 

Source: "Mods\EXTRAS\WoTTweakerPlus.097.v12.exe"; DestDir: "{app}\res_mods"; Flags: ignoreversion; Tasks: tweak;

 

If you have the above, can some statement be added to this line so when it copies to the DestDir it get's renamed to say "Tweaker.exe"?

 

I have like 70 Server Reticle .dds images, and I don't want to create folders, and a directory structure for each one.

 

Thanks

 

UPDATE....   UPDATE2..... It worked.

 

I think I found out how to do this..... with DestName.

 

[Files]
Source: "Api\Local.config"; DestDir: "{app}\Api\"; DestName: "Local.config.tmp"; Flags: ignoreversion recursesubdirs

Edited by leeuniverse

Share this post


Link to post

Short link
Share on other sites

Несколько вопросов.
1. Подскажите пожалуйста, как прописать гет запрос. А то по разному пробовал, не получается.

2. Какой язык программирования использует Инно? Делфи?

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...