elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  [Inno Setup] Crear un boton
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Inno Setup] Crear un boton  (Leído 1,823 veces)
DeXon18

Desconectado Desconectado

Mensajes: 25


Ver Perfil
[Inno Setup] Crear un boton
« en: 11 Abril 2014, 13:26 pm »

HOla buenas, llevo toda la mañana mirando como crear un boton(justo al lado de atras) en el apartado de la selección de los complementos, y que cuando se pulse en el aparezca como un label que muestre lo que tengo generado en el codigo.
Código
  1. [Setup]
  2. Appname=My Program
  3. AppVername=My Program version 1.5
  4. DefaultDirname=%25257Bpf%25257D%25255CMy Program
  5. DefaultGroupname=My Program
  6. OutputDir=.
  7.  
  8. [Types]
  9. Name: "full"; Description: "Full installation"
  10. Name: "compact"; Description: "Compact installation"
  11. Name: "custom"; Description: "Custom installation"; Flags: iscustom
  12.  
  13. [Components]
  14. Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
  15. Name: "help"; Description: "Help File"; Types: full
  16. Name: "readme"; Description: "Readme File"; Types: full
  17. Name: "readme\en"; Description: "English"; Flags: exclusive
  18. Name: "readme\de"; Description: "German"; Flags: exclusive
  19.  
  20. [Files]
  21. Source: descctrl.dll; Flags: dontcopy
  22.  
  23. [_Code]
  24. #ifdef UNICODE
  25.  #define AW "W"
  26. #else
  27.  #define AW "A"
  28. #endif
  29.  
  30. type
  31.  HMONITOR = THandle;
  32.  TMonitorInfo = record
  33.    cbSize: DWORD;
  34.    rcMonitor: TRect;
  35.    rcWork: TRect;
  36.    dwFlags: DWORD;
  37.  end;
  38.  
  39. const
  40.  MONITOR_DEFAULTTONULL = $0;
  41.  MONITOR_DEFAULTTOPRIMARY = $1;
  42.  MONITOR_DEFAULTTONEAREST = $2;
  43.  
  44. function GetMonitorInfo(hMonitor: HMONITOR; out lpmi: TMonitorInfo): BOOL;
  45.  external 'GetMonitorInfo{#AW}@user32.dll stdcall';
  46. function MonitorFromWindow(hwnd: HWND; dwFlags: DWORD): HMONITOR;
  47.  external 'MonitorFromWindow@user32.dll stdcall';
  48.  
  49. procedure CenterForm(Form: TForm; Horz, Vert: Boolean);
  50. var
  51.  X, Y: Integer;
  52.  Monitor: HMONITOR;
  53.  MonitorInfo: TMonitorInfo;
  54. begin
  55.  if not (Horz or Vert) then
  56.    Exit;
  57.  Monitor := MonitorFromWindow(Form.Handle, MONITOR_DEFAULTTONEAREST);
  58.  MonitorInfo.cbSize := SizeOf(MonitorInfo);
  59.  if GetMonitorInfo(Monitor, MonitorInfo) then
  60.  begin
  61.    if not Horz then
  62.      X := Form.Left
  63.    else
  64.      X := MonitorInfo.rcWork.Left + ((MonitorInfo.rcWork.Right -
  65.        MonitorInfo.rcWork.Left) - Form.Width) div 2;
  66.    if not Vert then
  67.      Y := Form.Top
  68.    else
  69.      Y := MonitorInfo.rcWork.Top + ((MonitorInfo.rcWork.Bottom -
  70.        MonitorInfo.rcWork.Top) - Form.Height) div 2;
  71.    Form.SetBounds(X, Y, Form.Width, Form.Height);
  72.  end;
  73. end;
  74.  
  75.  
  76. function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
  77. function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';
  78.  
  79. var
  80.  Info: TNewStaticText;
  81.  InfoCaption: TNewStaticText;
  82.  InfoPanel: TPanel;
  83.  
  84. procedure DeinitializeSetup();
  85. begin
  86.  disabledesc();
  87. end;
  88.  
  89. type
  90.  TPositionStorage = array of Integer;
  91.  
  92. var
  93.  CompPageModified: Boolean;
  94.  CompPagePositions: TPositionStorage;
  95.  
  96. procedure SaveComponentsPage(out Storage: TPositionStorage);
  97. begin
  98.  SetArrayLength(Storage, 10);
  99.  
  100.  Storage[0] := WizardForm.Height;
  101.  Storage[1] := WizardForm.NextButton.Top;
  102.  Storage[2] := WizardForm.BackButton.Top;
  103.  Storage[3] := WizardForm.CancelButton.Top;
  104.  Storage[4] := WizardForm.ComponentsList.Height;
  105.  Storage[5] := WizardForm.OuterNotebook.Height;
  106.  Storage[6] := WizardForm.InnerNotebook.Height;
  107.  Storage[7] := WizardForm.Bevel.Top;
  108.  Storage[8] := WizardForm.BeveledLabel.Top;
  109.  Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
  110. end;
  111.  
  112. procedure LoadComponentsPage(const Storage: TPositionStorage;
  113.  HeightOffset: Integer);
  114. begin
  115.  if GetArrayLength(Storage) <> 10 then
  116.    RaiseException('Invalid storage array length.');
  117.  
  118.  WizardForm.Height := Storage[0] + HeightOffset;
  119.  WizardForm.NextButton.Top := Storage[1] + HeightOffset;
  120.  WizardForm.BackButton.Top := Storage[2] + HeightOffset;
  121.  WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
  122.  WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;
  123.  WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
  124.  WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
  125.  WizardForm.Bevel.Top := Storage[7] + HeightOffset;
  126.  WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
  127.  WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
  128. end;
  129.  
  130.  
  131.  
  132. // Meter esto al pulsar el botón detalles
  133.  procedure InitializeWizard();
  134.  begin
  135.    WizardForm.ComponentsList.Height := ScaleY(90);
  136.    WizardForm.ComponentsList.Width := ScaleX(415);
  137.  
  138.    InfoPanel := TPanel.Create(WizardForm);
  139.    InfoPanel.Parent := WizardForm.SelectComponentsPage;
  140.    InfoPanel.Top := Scaley(360);
  141.    InfoPanel.Left := ScaleX(0);
  142.    InfoPanel.Width := WizardForm.ComponentsList.Width;
  143.    InfoPanel.Height := ScaleY(50);
  144.    InfoPanel.BevelInner := bvRaised;
  145.    InfoPanel.BevelOuter := bvLowered;
  146.    Info := TNewStaticText.Create(WizardForm);
  147.    Info.Parent := InfoPanel;
  148.    Info.AutoSize := true;
  149.    Info.Left := ScaleX(6);
  150.    Info.Width := ScaleX(400);
  151.    Info.Top := ScaleY(5); // Linea de texto
  152.    Info.WordWrap := true;
  153.    enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
  154.          // Sustituir por ExpandConstant('{cm:Descripcion};') +
  155.         'Descrip. Program Files;'+
  156.         'Descrip. Help File;'+
  157.         'Descrip. Readme File;'+
  158.         'Descrip. English;'+
  159.         'Descrip. German;'
  160.         );
  161.  
  162.    begin
  163.      CompPageModified := False;
  164.    end;
  165.  end;
  166. // Meter esto al pulsar el botón detalles
  167.  
  168.  
  169. procedure CurPageChanged(CurPageID: Integer);
  170. begin
  171.  if CurpageID = wpSelectComponents then
  172.  begin
  173.    SaveComponentsPage(CompPagePositions);
  174.    LoadComponentsPage(CompPagePositions, 200);
  175.    CenterForm(WizardForm, False, True);
  176.    CompPageModified := True;
  177.  end
  178.  else
  179.  if CompPageModified then
  180.  begin
  181.    LoadComponentsPage(CompPagePositions, 0);
  182.    CenterForm(WizardForm, False, True);
  183.    CompPageModified := False;
  184.  end;
  185. end;
  186.  

Espero que me podais hechar una mano ya no se donde mirar ya que no encuentro mucha informacion.
Un saludo y mil gracias de antemano


« Última modificación: 11 Abril 2014, 13:35 pm por DeXon18 » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines