Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Readin a DFM file

Status
Not open for further replies.

alphonsus

Technical User
Dec 18, 2000
16
0
0
BR
Hi all,

we need to write a procedure that reads a DFM file and assigns the Form defined in it to program variable, so that we can add Components to it (won't be visual). This program should not rely on any of IDE's feature.

Any help will be welcomed.

Thanks,

Alphonsus.
 
I don't quite understand what you'd like... Can you give me an example, what you need it for ? :-I
Raz (just trying to be useful)
 
Alphonsus,

You didn't say which version you're using, so I'll punt: Every version of Delphi provides a CONVERT utility in the BIN\ folder. I would consider creating (and calling) batch files that, in turn, call CONVERT appropriately.

Hope this helps...

-- Lance

P.S. Delphi 5, by default, saves forms in ASCII. Just thought I'd mention it. ;-)
 

procedure DoSomething( FileName: string; CompClass: TComponentClass );

var F: TForm;
C: TComponent;
begin
F := TForm.CreateNew(nil);
try
ReadComponentResFile(FileName, F);
C := TComponent.Create(F);
if C is TControl then (C as TControl).Parent := F;
WriteComponentResFile(FileName,F);
finally
F.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
DoSomething('unit1.dfm', TButton);
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top