Einzelnen Beitrag anzeigen

wschrabi

Registriert seit: 16. Jan 2005
448 Beiträge
 
#9

AW: Mehrsprachingkeit

  Alt 24. Nov 2020, 12:56
Habe das jetzt so gelöst:

In UnitFGMain:
Delphi-Quellcode:

uses Unit1MergeMe,
  Unit1 in '..\Unit1.dfm{Form1},
  Unit2 in '..\Unit2.pas{Form2},
  Unit3 in '..\Unit3.pas{Form3},
  Unit4TC in '..\Unit4TC.pas{Form4TC},
  Unit5TC in '..\Unit5TC.pas{Form5TC},
  Unit6 in '..\Unit6.pas{Form6},
  Unitindi2 in '..\Unitindi2.pas{Formindi2},
  Unitindi1 in '..\Unitindi1.pas{Formindi1},
  Unit8 in '..\Unit8.pas{Form8},
  Unit7 in '..\Unit7.pas{Form7},
  RegExpr in '..\RegExpr.pas',
  USBError in '..\USBError.pas{USBErrorForm},
  md5 in '..\md5.pas',
  PrintFormUnit in '..\PrintFormUnit.pas{Form9},
  Unit10 in '..\Unit10.pas{Form10},
  DevReader in '..\HIDKomponente\HIDKomponente\DEMOS\Delphi\ReadWriteDemo\DevReader.pas{MainForm},
  Info in '..\HIDKomponente\HIDKomponente\DEMOS\Delphi\ReadWriteDemo\Info.pas{InfoForm},
  Unit11 in '..\Unit11.pas{Form11},
  Unit4 in '..\Unit4.pas{Form4},
  Unit5 in '..\Unit5.pas{Form5},
  Unit12 in '..\Unit12.pas{Form12},
  Unit13 in '..\Unit13.pas{Form13},
  SetupApi in '..\HIDKomponente\HIDKomponente\SetupApi.pas',
  ModuleLoader in '..\HIDKomponente\HIDKomponente\ModuleLoader.pas',
  WinConvTypes in '..\HIDKomponente\HIDKomponente\WinConvTypes.pas',
  Unit111 in '..\SQLite\Unit111.pas{Form111},
  Unit14 in '..\Unit14.pas{Form14},
  UnitMergeMe in '..\UnitMergeMe.pas{FormMergeMe},
  UnitTrans in '..\UnitTrans.pas';

{$R *.RES}

;

procedure TFormFG.Button1Click(Sender: TObject);
begin
   formfind.showmodal;
end;

procedure TFormFG.FormCreate(Sender: TObject);
begin
  MyForms := TStringList.Create;
  Application.CreateForm(TForm1, Form1); Myforms.items.add('Form1');
  Application.CreateForm(TForm2, Form2); Myforms.items.add('Form2');
  Application.CreateForm(TFrmBlatt, FrmBlatt); Myforms.items.add('FrmBlatt');
  Application.CreateForm(TForm4, Form4); Myforms.items.add('Form4');
  Application.CreateForm(TForm4TC, Form4TC); Myforms.items.add('Form4TC');
  Application.CreateForm(TForm5TC, Form5TC); Myforms.items.add('Form5TC');
  Application.CreateForm(TForm6, Form6); Myforms.items.add('Form6');
  Application.CreateForm(TFormindi2, Formindi2); Myforms.items.add('Formindi2');
  Application.CreateForm(TFormindi1, Formindi1); Myforms.items.add('Formindi1');
  Application.CreateForm(TForm8, Form8); Myforms.items.add('Form8');
  Application.CreateForm(TForm7, Form7); Myforms.items.add('Form7');
  Application.CreateForm(TUSBErrorForm, USBErrorForm); Myforms.items.add('USBErrorForm');
  Application.CreateForm(TForm9, Form9); Myforms.items.add('Form9');
  Application.CreateForm(TForm10, Form10); Myforms.items.add('Form10');
  Application.CreateForm(TMainForm, MainForm); Myforms.items.add('MainForm');
  Application.CreateForm(TInfoForm, InfoForm); Myforms.items.add('InfoForm');
  Application.CreateForm(TForm11, Form11); Myforms.items.add('Form11');
  Application.CreateForm(TForm4, Form4); Myforms.items.add('Form4');
  Application.CreateForm(TForm5, Form5); Myforms.items.add('Form5');
  Application.CreateForm(TForm12, Form12); Myforms.items.add('Form12');
  Application.CreateForm(TForm13, Form13); Myforms.items.add('Form13');
  Application.CreateForm(TForm111, Form111); Myforms.items.add('Form111');
  Application.CreateForm(TForm14, Form14); Myforms.items.add('Form14');
  Application.CreateForm(TFormMergeMe, FormMergeMe); Myforms.items.add('FormMergeMe');

end;
und im HAuptModul hier:
Delphi-Quellcode:
unit Unit1MergeMe;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, system.IOUtils, StdCtrls ;

type
  TFormFIND = class(TForm)
    ListBoxtmp: TListBox;
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    Button2: TButton;
    OpenDialog2: TOpenDialog;
    Button3: TButton;
   // gtPDFDocument1: TgtPDFDocument;
   // gtPDFDocumentCOVER: TgtPDFDocument;
    ListBoxEnd: TListBox;
    SaveDialog1: TSaveDialog;
    Memo1: TMemo;
    CheckBox1: TCheckBox;
    //gtPDFDocument2: TgtPDFDocument;
    CheckBox2: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
      function GetTempDirectory: String;
      PROCEDURE GetComponentCaptions(frm:TForm; FN: string);
      
      
      
    
  public
    { Public-Deklarationen }
  end;

var
  FormFIND: TFormFIND;
  mypath: string;

implementation

{$R *.dfm}

uses UnitFGMain, Typinfo;

const
CSCaption = 'Caption';

procedure TFormFIND.Button1Click(Sender: TObject);
begin
   if opendialog1.Execute then
      begin
        edit1.Text:= Opendialog1.FileName;
      end;

end;



function filenameconform(fn:string):string;
begin
  fn:=stringreplace(fn,' ','_',[rfReplaceall]);
  fn:=stringreplace(fn,'.','_',[rfReplaceall]);
  fn:=stringreplace(fn,':','_',[rfReplaceall]);
  result:=fn;
end;

procedure TFormFIND.Button3Click(Sender: TObject);
var
  i: Integer;
  mymergedfn: string;
begin
savedialog1.filename:=format('%sGREPFORM.pas',[mypath]);
if Savedialog1.execute then
   begin
   for i := 0 to myforms.Count-1 do
      begin
      GetComponentCaptions(TForm(myforms[i]),savedialog1.filename);
      end;
   end;
end;

PROCEDURE Tformfind.GetComponentCaptions(frm: TForm ; FN: string);
   VAR
    texts: TStringList;
     comp: TComponent;
     capt: String;
        i: Integer;
        

   BEGIN

    texts := TStringList.Create;
    TRY
     WITH texts
      DO BEGIN
          Duplicates := dupIgnore;
          Sorted := True;
          FOR i:=0 TO frm.ComponentCount-1
           DO
           begin
               comp := frm.Components[i];
               if comp is TControl then
               begin
               if IsPublishedProp(Comp, CSCaption) then
                  begin
                  capt:=GetStrProp(Comp, CSCaption);

                  IF (comp.Name <> '')
                    AND
                     (capt <> '')
                   THEN Add(comp.Name+'='+capt);

                  end;
               end;
             SaveToFile(FN)
           end;
         END;
    FINALLY
     texts.Free
    END
   END;

   
function TFormFIND.GetTempDirectory: String;
var
  tempFolder: array[0..MAX_PATH] of Char;
begin
  //GetTempPath(MAX_PATH, @tempFolder);
  //result := StrPas(tempFolder);
  result:=TPath.GetTempPath;
end;



function ReportTime(const Name: string; const FileTime: TFileTime): string;
 var
   SystemTime, LocalTime: TSystemTime;
 begin
   if not FileTimeToSystemTime(FileTime, SystemTime) then
     RaiseLastOSError;
   if not SystemTimeToTzSpecificLocalTime(nil, SystemTime, LocalTime) then
     RaiseLastOSError;
   result:=Name + ': ' + DateTimeToStr(SystemTimeToDateTime(LocalTime));
 end;

procedure GetBuildInfo(var V1, V2, V3, V4: word);
var
  VerInfoSize, VerValueSize, Dummy: DWORD;
  VerInfo: Pointer;
  VerValue: PVSFixedFileInfo;
begin
  VerInfoSize := GetFileVersionInfoSize(PChar(ParamStr(0)), Dummy);
  if VerInfoSize > 0 then
  begin
      GetMem(VerInfo, VerInfoSize);
      try
        if GetFileVersionInfo(PChar(ParamStr(0)), 0, VerInfoSize, VerInfo) then
        begin
          VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
          with VerValue^ do
          begin
            V1 := dwFileVersionMS shr 16;
            V2 := dwFileVersionMS and $FFFF;
            V3 := dwFileVersionLS shr 16;
            V4 := dwFileVersionLS and $FFFF;
          end;
        end;
      finally
        FreeMem(VerInfo, VerInfoSize);
      end;
  end;
end;

function GetBuildInfoAsString: string;
var
  V1, V2, V3, V4: word;
begin
  GetBuildInfo(V1, V2, V3, V4);
  Result := IntToStr(V1) + '.' + IntToStr(V2) + '.' +
    IntToStr(V3) + '.' + IntToStr(V4);
end;

procedure TFormFIND.FormCreate(Sender: TObject);

var
   targetinfo: string;
   fad: TWin32FileAttributeData;
   
begin

  if not GetFileAttributesEx(PChar(Application.ExeName), GetFileExInfoStandard, @fad) then
    RaiseLastOSError;
  //ReportTime('Created', fad.ftCreationTime);
  //ReportTime('Modified', fad.ftLastWriteTime);
  //ReportTime('Accessed', fad.ftLastAccessTime);

   {$IFDEF WIN64}
      targetinfo:=' (x64 Architecture)';
     {$ELSE}
      targetinfo:=' Architecture: 32bit';
     {$ENDIF}

   targetinfo := targetinfo + format(' %s : %s',
         [ReportTime('Created', fad.ftCreationTime),
         ReportTime('Modified', fad.ftLastWriteTime)]) ;

  FormFIND.Caption := FormFIND.Caption+' - Build: ' + GetBuildInfoAsString + targetinfo;

end;


end.

Geändert von wschrabi (24. Nov 2020 um 12:59 Uhr)
  Mit Zitat antworten Zitat