ShadowHawk
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Setup] AppName=My Program AppVerName=My Program DefaultDirName={code:MyConst}\My Program OutputDir=. [Types] #define FileNameINI "tmp.ini" #define FileHandle #define FileLine #define CountSection 0 #dim org[100] #define i #sub ProcessFileLine // #pragma message str(Pos('[',FileLine))+" "+ str(Pos(']',FileLine))+" "+ str(len(FileLine)) #if (Pos("[", FileLine) == 1) && (Pos(']', FileLine) == Len(FileLine) ) #expr org[CountSection] = FileLine #expr CountSection = CountSection + 1 #endif #endsub #for {FileHandle = FileOpen(FileNameINI); \ FileHandle && !FileEof(FileHandle); FileLine = FileRead(FileHandle)} \ ProcessFileLine #if FileHandle #expr FileClose(FileHandle) #endif #pragma message 'countSection = '+str(countSection) #sub AddTypes #pragma message org[i] Name: org[i]; Description: org[i] #endsub #for {i = 0; i < countSection; i++} AddTypes [code] function MyConst(Param: String): String; begin Log('MyConst(''' + Param + ''') called'); Result := ExpandConstant('{pf}'); end; function GCS: String; var S: TArrayOfString; F: String; i,n: Integer; FileNameINI: string; begin FileNameINI := 'tmp.ini'; n := 0 Result := ''; if FileExists(FileNameINI) then begin LoadStringsFromFile(FileNameINI, S); for i := 0 to GetArrayLength(S)-1 do begin if (Pos('[', S[i]) = 1) and (Pos(']', S[i]) = Length(S[i]) ) then begin n := n + 1; end; end; end; Result := IntToStr(n); end; procedure MyButtonOnClick(Sender: TObject); begin MsgBox( GCS, mbInformation, MB_OK); end; procedure PanelButtons(); var MyButton: TButton; MyPanel: TPanel; Begin MyPanel := TPanel.Create( WizardForm ); with MyPanel do begin Parent := WizardForm; Left := WizardForm.WelcomePage.Left; Top := WizardForm.WelcomePage.Height + ScaleX(1); Width := WizardForm.WelcomePage.Width- 200; Height := WizardForm.ClientHeight - WizardForm.WelcomePage.Height - 2; Align := alBottom; End; WizardForm.NextButton.Parent := MyPanel; WizardForm.CancelButton.Parent := MyPanel; WizardForm.BackButton.Parent := MyPanel; WizardForm.NextButton.Top := WizardForm.NextButton.Top - (WizardForm.WelcomePage.Height + ScaleX(1)); WizardForm.CancelButton.Top := WizardForm.CancelButton.Top - (WizardForm.WelcomePage.Height + ScaleX(1)); WizardForm.BackButton.Top := WizardForm.BackButton.Top - (WizardForm.WelcomePage.Height + ScaleX(1)); MyButton:=TButton.Create( WizardForm ); with MyButton do begin Parent:=MyPanel; Top:=WizardForm.BackButton.Top; Left:=WizardForm.BackButton.Left - WizardForm.BackButton.Width - 30; Width:=WizardForm.BackButton.Width + 30; Height:=WizardForm.BackButton.Height; Caption:='Сколько секций'; OnClick:=@MyButtonOnClick; Font.Name:= 'arial'; Font.Size:= 9; Font.Style:= [fsBold, fsItalic]; end; end; procedure InitializeWizard(); begin MsgBox ( '{#countSection}', mbInformation, MB_OK); PanelButtons(); end; | Всего записей: 28 | Зарегистр. 18-08-2011 | Отправлено: 19:10 13-09-2011 | Исправлено: ShadowHawk, 19:18 13-09-2011 |
|