was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

27 Visitors Online


 
...alle verfügbaren Formulare eines Projekts auflisten?
Autor: P. Below
Homepage: http://www.teamb.com
[ Tip ausdrucken ]  

Tip Bewertung (1):  
     


function EnumResTypes(hMod: THandle; restype, resname: PChar; Lines: TStrings): BOOL; stdcall;
var
  
ms: TMemoryStream;
  rs: TResourceStream;
  S: string;
  i: Integer;
begin
  
Result := True;
  SetLength(S, 10000);
  if Assigned(resname) then
  begin
    
rs := TResourceStream.Create(hinstance, resname, restype);
    try
      try
        
ms := TMemoryStream.Create;
        try
          
ObjectBinaryToText(rs, ms);
          SetLength(S, ms.Size);
          ms.Position := 0;
          ms.read(S[1], ms.Size);

          Lines.Add(resname);
          Lines.Add('Length of data is ' + IntToStr(Length(S)));
          i := Pos(#13, S);
          if i > 0 then
          begin
            
SetLength(S, i - 1);
            Lines.Add(S);
            i := Pos('object', S);
            if i > 0 then
            begin
              
Delete(S, 1, i + 6);
              i := Pos(' ', S);
              if i > 0 then
              begin
                
Lines.Add('Form name is: ' + Copy(S, 1, i - 2));
                Delete(S, 1, i);
                Lines.Add('Form class is: ' + S);
              end;
            end
          end
          else
          begin
            
// Lines.Add('This resource seems not to hold a form');
          
end;
        finally
          
ms.Free
        end;
      except
        
// Lines.Add('This resource is not a form resource');
      
end;
    finally
      
rs.Free;
    end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if not 
EnumResourceNames(0, RT_RCDATA, @EnumResTypes, Integer(Memo1.Lines)) then
    
Memo1.Lines.Add('Error, GetLastError Returns ' + IntToHex(GetLastError, 8));
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners